Documentation ¶
Index ¶
- Constants
- Variables
- func GetTimeUTCString() string
- type ConsoleLogger
- func (clg *ConsoleLogger) Debug(message string, args ...interface{})
- func (clg *ConsoleLogger) Error(message string, args ...interface{})
- func (clg *ConsoleLogger) Fatal(message string, args ...interface{})
- func (clg *ConsoleLogger) GetLogLevel() int
- func (clg *ConsoleLogger) Info(message string, args ...interface{})
- func (clg *ConsoleLogger) Raw(message string, args ...interface{})
- func (clg *ConsoleLogger) SetLogLevel(loglevel int)
- func (clg *ConsoleLogger) Warn(message string, args ...interface{})
- type Logger
- type MockLogger
- func (me *MockLogger) Debug(message string, args ...interface{})
- func (me *MockLogger) Error(message string, args ...interface{})
- func (me *MockLogger) Fatal(message string, args ...interface{})
- func (me *MockLogger) GetLogLevel() int
- func (me *MockLogger) Info(message string, args ...interface{})
- func (me *MockLogger) Raw(message string, args ...interface{})
- func (me *MockLogger) SetLogLevel(loglevel int)
- func (me *MockLogger) Warn(message string, args ...interface{})
- type ScopedLogger
- func (slg *ScopedLogger) Debug(message string, args ...interface{})
- func (slg *ScopedLogger) Error(message string, args ...interface{})
- func (slg *ScopedLogger) Fatal(message string, args ...interface{})
- func (slg *ScopedLogger) GetLogLevel() int
- func (slg *ScopedLogger) Info(message string, args ...interface{})
- func (slg *ScopedLogger) Raw(message string, args ...interface{})
- func (slg *ScopedLogger) SetLogLevel(loglevel int)
- func (slg *ScopedLogger) Warn(message string, args ...interface{})
Constants ¶
const ( LOG_LEVEL_UNKNOWN = iota LOG_LEVEL_DEBUG = iota LOG_LEVEL_INFO = iota LOG_LEVEL_WARN = iota LOG_LEVEL_ERROR = iota LOG_LEVEL_FATAL = iota )
Individual log levels
Variables ¶
var LogLevelString map[int]string = map[int]string{ LOG_LEVEL_DEBUG: "DEBUG", LOG_LEVEL_INFO: "INFO", LOG_LEVEL_WARN: "WARN", LOG_LEVEL_ERROR: "ERROR", LOG_LEVEL_FATAL: "FATAL", }
Map of int log levels to string log level names
var StringLogLevel map[string]int = map[string]int{ "DEBUG": LOG_LEVEL_DEBUG, "INFO": LOG_LEVEL_INFO, "WARN": LOG_LEVEL_WARN, "ERROR": LOG_LEVEL_ERROR, "FATAL": LOG_LEVEL_FATAL, }
Map of uppercase log level name strings to int log levels
Functions ¶
func GetTimeUTCString ¶
func GetTimeUTCString() string
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct { LogLevel int // contains filtered or unexported fields }
ConsoleLogger is a type to provide ConsoleLogger to the system
func NewConsoleLogger ¶
func NewConsoleLogger(logLevel string) *ConsoleLogger
NewConsoleLogger creates a New ConsoleLogger with the loglevel supplied
func (*ConsoleLogger) Debug ¶
func (clg *ConsoleLogger) Debug(message string, args ...interface{})
Debug logs a DEBUG message with the specified message and Printf-style arguments.
func (*ConsoleLogger) Error ¶
func (clg *ConsoleLogger) Error(message string, args ...interface{})
Error logs an ERROR message with the specified message and Printf-style arguments.
func (*ConsoleLogger) Fatal ¶
func (clg *ConsoleLogger) Fatal(message string, args ...interface{})
Fatal logs a FATAL message with the specified message and Printf-style arguments.
func (*ConsoleLogger) GetLogLevel ¶
func (clg *ConsoleLogger) GetLogLevel() int
GetLogLevel gets the current log level
func (*ConsoleLogger) Info ¶
func (clg *ConsoleLogger) Info(message string, args ...interface{})
Info logs an INFO message with the specified message and Printf-style arguments.
func (*ConsoleLogger) Raw ¶
func (clg *ConsoleLogger) Raw(message string, args ...interface{})
Raw logs a Raw message (-----) with the specified message and Printf-style arguments.
func (*ConsoleLogger) SetLogLevel ¶
func (clg *ConsoleLogger) SetLogLevel(loglevel int)
SetLogLevel sets the current log level
func (*ConsoleLogger) Warn ¶
func (clg *ConsoleLogger) Warn(message string, args ...interface{})
Warn logs a WARN message with the specified message and Printf-style arguments.
type Logger ¶
type Logger interface { GetLogLevel() int SetLogLevel(loglevel int) Raw(message string, args ...interface{}) Fatal(message string, args ...interface{}) Error(message string, args ...interface{}) Warn(message string, args ...interface{}) Info(message string, args ...interface{}) Debug(message string, args ...interface{}) }
type MockLogger ¶
MockLogger is only used in testing, and simply stores the last log output.
func NewMockLogger ¶
func NewMockLogger(timeprefix string) *MockLogger
The function creates a New MockLogger with the loglevel supplied
func (*MockLogger) Debug ¶
func (me *MockLogger) Debug(message string, args ...interface{})
Logs a DEBUG message with the specified component, message and Printf-style arguments.
func (*MockLogger) Error ¶
func (me *MockLogger) Error(message string, args ...interface{})
Logs an ERROR message with the specified component, message and Printf-style arguments.
func (*MockLogger) Fatal ¶
func (me *MockLogger) Fatal(message string, args ...interface{})
Logs a FATAL message with the specified component, message and Printf-style arguments.
func (*MockLogger) GetLogLevel ¶
func (me *MockLogger) GetLogLevel() int
func (*MockLogger) Info ¶
func (me *MockLogger) Info(message string, args ...interface{})
Logs an INFO message with the specified component, message and Printf-style arguments.
func (*MockLogger) Raw ¶
func (me *MockLogger) Raw(message string, args ...interface{})
Logs a Raw message (-----) with the specified component, message and Printf-style arguments.
func (*MockLogger) SetLogLevel ¶
func (me *MockLogger) SetLogLevel(loglevel int)
func (*MockLogger) Warn ¶
func (me *MockLogger) Warn(message string, args ...interface{})
Logs a WARN message with the specified component, message and Printf-style arguments.
type ScopedLogger ¶
func NewScopedLogger ¶
func NewScopedLogger(name string, logger Logger) *ScopedLogger
func (*ScopedLogger) Debug ¶
func (slg *ScopedLogger) Debug(message string, args ...interface{})
Debug logs a DEBUG message with the specified message and Printf-style arguments.
func (*ScopedLogger) Error ¶
func (slg *ScopedLogger) Error(message string, args ...interface{})
Error logs an ERROR message with the specified message and Printf-style arguments.
func (*ScopedLogger) Fatal ¶
func (slg *ScopedLogger) Fatal(message string, args ...interface{})
Fatal logs a FATAL message with the specified message and Printf-style arguments.
func (*ScopedLogger) GetLogLevel ¶
func (slg *ScopedLogger) GetLogLevel() int
func (*ScopedLogger) Info ¶
func (slg *ScopedLogger) Info(message string, args ...interface{})
Info logs an INFO message with the specified message and Printf-style arguments.
func (*ScopedLogger) Raw ¶
func (slg *ScopedLogger) Raw(message string, args ...interface{})
Raw logs a Raw message (-----) with the specified message and Printf-style arguments.
func (*ScopedLogger) SetLogLevel ¶
func (slg *ScopedLogger) SetLogLevel(loglevel int)
func (*ScopedLogger) Warn ¶
func (slg *ScopedLogger) Warn(message string, args ...interface{})
Warn logs a WARN message with the specified message and Printf-style arguments.