Documentation ¶
Overview ¶
Package logger provides a simple logging interface that supports multiple levels of logging. It goes up to 11.
Index ¶
- Constants
- Variables
- func MustBlocked(format string, v ...interface{})
- func MustDebug(format string, v ...interface{})
- func MustError(format string, v ...interface{})
- func MustInfo(format string, v ...interface{})
- func MustInit(format string, v ...interface{})
- func MustInstall(format string, v ...interface{})
- func MustListen(format string, v ...interface{})
- func MustReject(format string, v ...interface{})
- func MustRequest(format string, v ...interface{})
- func MustUnblocked(format string, v ...interface{})
- func MustWarn(format string, v ...interface{})
- type Logger
- func (l *Logger) Blocked(format string, v ...interface{})
- func (l *Logger) Debug(format string, v ...interface{})
- func (l *Logger) Error(format string, v ...interface{})
- func (l *Logger) Info(format string, v ...interface{})
- func (l *Logger) Init(format string, v ...interface{})
- func (l *Logger) Install(format string, v ...interface{})
- func (l *Logger) Level() int
- func (l *Logger) Listen(format string, v ...interface{})
- func (l *Logger) Reject(format string, v ...interface{})
- func (l *Logger) Request(format string, v ...interface{})
- func (l *Logger) SetLevel(level int) error
- func (l *Logger) Unblocked(format string, v ...interface{})
- func (l *Logger) Warn(format string, v ...interface{})
Constants ¶
View Source
const ( // Silent logs no output at all. Silent = iota // Error logs only errors. Error = iota // Blocked logs blocking calls and lower. Blocked = iota // Unblocked logs all unblocked notifications and lower. Unblocked = iota // Warn logs warnings and lower. Warn = iota // Reject logs rejections (e.g., in a firewall) and lower. Reject = iota // Listen logs listeners and lower. Listen = iota // Install logs install notifications and lower. Install = iota // Init logs initialization notifications and lower. Init = iota // Request logs incoming requests and lower. Request = iota // Info logs info output and lower. Info = iota // Debug logs all log output. Debug = iota )
Variables ¶
View Source
var LogLevel = map[string]int{ "silent": Silent, "error": Error, "blocked": Blocked, "unblocked": Unblocked, "warn": Warn, "reject": Reject, "listen": Listen, "install": Install, "init": Init, "request": Request, "info": Info, "debug": Debug}
LogLevel translates human-readable log level names to their int values.
Functions ¶
func MustBlocked ¶
func MustBlocked(format string, v ...interface{})
MustBlocked logs a blocked message.
func MustInit ¶
func MustInit(format string, v ...interface{})
MustInit logs an initialization message.
func MustInstall ¶
func MustInstall(format string, v ...interface{})
MustInstall logs an install message.
func MustListen ¶
func MustListen(format string, v ...interface{})
MustListen logs a listener message.
func MustUnblocked ¶
func MustUnblocked(format string, v ...interface{})
MustUnblocked logs an unblocked message.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger only outputs log messages that are equal or lower than its log level.
func New ¶
New instantiates a Logger and sets its level. If the level is invalid, it returns an error.
Click to show internal directories.
Click to hide internal directories.