Documentation ¶
Index ¶
- Constants
- Variables
- func SetCustomSocket(address, network string) (err error)
- func SetLogName(p string) (err error)
- func Stats() (logs, pending, drop, errs uint64)
- type Level
- type Logger
- func (l *Logger) Close()
- func (l *Logger) Debug(prefix, format string, v ...interface{})
- func (l *Logger) Error(prefix, format string, v ...interface{})
- func (l *Logger) Info(prefix, format string, v ...interface{})
- func (l *Logger) Level() Level
- func (l *Logger) Panic(prefix, format string, v ...interface{})
- func (l *Logger) Print(logMsg string)
- func (l *Logger) Printf(level Level, prefix, format string, v ...interface{})
- func (l *Logger) SetAccessLogSample(sample uint64)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) Warn(prefix, format string, v ...interface{})
Constants ¶
View Source
const ( NumMessages = 10 * 1024 // number of allowed log messages MaxFreeMsgSize = 8 * 1024 // maximum size of a free pooled msg )
Variables ¶
View Source
var ( // offLogger is a dummy no-op logger. OffLogger = New(Levels.Off) // Levels is a singleton that represents possible log levels. Levels = struct { Off Level Panic Level Error Level Warn Level Info Level Debug Level Access Level }{ Access: (-1), Off: (0), Panic: (1), Error: (2), Warn: (3), Info: (4), Debug: (5), } // CfgLevels maps strings to Level. The intent is to use this during config // time. CfgLevels = map[string]Level{ "access": Levels.Access, "off": Levels.Off, "panic": Levels.Panic, "error": Levels.Error, "warn": Levels.Warn, "info": Levels.Info, "debug": Levels.Debug, } )
Functions ¶
func SetCustomSocket ¶
When called, this will switch over to writting log messages to the defined socket.
func SetLogName ¶
SetLogName sets the indentifier used by syslog for this program
func Stats ¶
func Stats() (logs, pending, drop, errs uint64)
Stats returns the current status of the logger. It reports: * logs: number of logs attempted to be written since startup * pending: number of logs queued to be written * drop: numer of logs that have been dropped, because the write queue is full, since startup * errs: number of errors seen while trying to write logs since startup
Types ¶
Click to show internal directories.
Click to hide internal directories.