Documentation ¶
Overview ¶
Package log implements a minimal leveled logging library.
Example
var logger = log.Get("ExampleName") func main() { logger.SetLevel(log.INFO) logger.Debug("This is a debug message") logger.Info("This is a info message") logger.Warn("This is a warning message") logger.Error("This is an error message") logger.Warnf("This is a number %v", 1) }
Index ¶
- Constants
- func Colored(color string, text string) string
- func GetRegistry() map[string]*Logger
- type Logger
- func (l *Logger) Debug(format string, a ...interface{}) error
- func (l *Logger) DisableCallerSourceLogging()
- func (l *Logger) Error(format string, a ...interface{}) error
- func (l *Logger) Fatal(format string, a ...interface{})
- func (l *Logger) GetLevel() int
- func (l *Logger) Info(format string, a ...interface{}) error
- func (l *Logger) Log(level int, format string, a ...interface{}) error
- func (l *Logger) SetCallerDepth(callerDepth int)
- func (l *Logger) SetColored(b bool)
- func (l *Logger) SetLevel(level int)
- func (l *Logger) SetNameLength(n int)
- func (l *Logger) SetWriter(w io.Writer)
- func (l *Logger) Smart(e error, format string, a ...interface{})
- func (l *Logger) Warn(format string, a ...interface{}) error
Constants ¶
View Source
const ( DEBUG int = iota INFO WARN ERROR )
Level
View Source
const (
DefaultCallerDepth = 2
)
default
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger abstraction.
func (*Logger) DisableCallerSourceLogging ¶
func (l *Logger) DisableCallerSourceLogging()
DisableCallerSourceLogging disables the logging for caller source. This sets to true by default.
func (*Logger) SetCallerDepth ¶
SetCallerDepth sets the caller depth for this logger.
func (*Logger) SetColored ¶
SetColored sets the color enability.
func (*Logger) SetNameLength ¶
SetNameLength sets the name length.
Click to show internal directories.
Click to hide internal directories.