Documentation ¶
Index ¶
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func SetLogger(l Logger)
- func SetOutputLevel(level Level)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug outputs given arguments via pre-set Logger implementation. Logging level must be set to DebugLevel via logger.SetOutputLevel
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf outputs given arguments with format via pre-set Logger implementation. Logging level must be set to DebugLevel via logger.SetOutputLevel
func Error ¶
func Error(args ...interface{})
Error outputs given arguments via pre-set Logger implementation.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf outputs given arguments with format via pre-set Logger implementation.
func Info ¶
func Info(args ...interface{})
Info outputs given arguments via pre-set Logger implementation. Logging level must be set to DebugLevel or InfoLevel via logger.SetOutputLevel
func Infof ¶
func Infof(format string, args ...interface{})
Infof outputs given arguments with format via pre-set Logger implementation. Logging level must be set to DebugLevel or InfoLevel via logger.SetOutputLevel
func SetLogger ¶
func SetLogger(l Logger)
SetLogger receives struct that satisfies Logger interface, and set this as logger. From this call forward, any call to logging method proxies arguments to corresponding logging method of given Logger. e.g. call to log.Info points to Logger.Info.
This method is "thread-safe."
func SetOutputLevel ¶
func SetOutputLevel(level Level)
SetOutputLevel sets what logging level to output. Application may call logging method any time, but Logger only outputs if the corresponding log level is equal to or higher than the level set here.
Types ¶
type Level ¶
type Level uint
Level indicates what logging level the output is representing. This typically indicates the severity of particular logging event.
const ( // ErrorLevel indicates the error state of events. This must be noted and be fixed. // In practical situation, fix may include lowering of the log level. ErrorLevel Level = iota // WarnLevel represents those events that are not critical, but deserves to note. WarnLevel // InfoLevel is used to inform what is happening inside the application. InfoLevel // DebugLevel indicates the output is logged for debugging purpose. DebugLevel )
type Logger ¶
type Logger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) }
Logger defines the interface that can be used as logging tool in this application. Developer may provide a customized logger via SetLogger to modify behavior. By default, instance of defaultLogger is set as default Logger just like http's DefaultClient.
func NewWithStandardLogger ¶
NewWithStandardLogger creates an instance of defaultLogger with Go's standard log.Logger. This can be used when implementing Logger interface is too much of a task, but still a bit of modification to defaultLogger is required.
Returning Logger can be fed to SetLogger to replace old defaultLogger.