Documentation ¶
Index ¶
- func LevelToString(id Level) (s string)
- type FileHandler
- func (h *FileHandler) Close()
- func (h *FileHandler) Level() Level
- func (h *FileHandler) LevelString() string
- func (h *FileHandler) RecordLog(message string, i []interface{}, logLvl Level, lineno string, name string, ...)
- func (h *FileHandler) SetFormatter(f Formatter)
- func (h *FileHandler) SetLevel(lvl Level)
- type Formatter
- type Handler
- type Level
- type Logger
- func (l *Logger) AddHandler(h Handler)
- func (l *Logger) AddParent(lo *Logger)
- func (l *Logger) Critical(s string, i ...interface{})
- func (l *Logger) Debug(s string, i ...interface{})
- func (l *Logger) Error(s string, i ...interface{})
- func (l *Logger) Info(s string, i ...interface{})
- func (l *Logger) NewLogger(name string) Logger
- func (l *Logger) Trace(s string, i ...interface{})
- func (l *Logger) Warn(s string, i ...interface{})
- type StandardFormatter
- type StdoutHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LevelToString ¶
LevelToString converts the inputted Level id into a string name of the level name
Types ¶
type FileHandler ¶ added in v0.2.0
type FileHandler struct {
// contains filtered or unexported fields
}
FileHandler is an implementation of the Handler interface that directs to stdout
func NewFileHandler ¶ added in v0.2.0
func NewFileHandler(path string) (FileHandler, error)
NewFileHandler returns an instantiated FileHandler type
func (*FileHandler) Close ¶ added in v0.2.0
func (h *FileHandler) Close()
Close closes the underlying os.File object
func (*FileHandler) Level ¶ added in v0.3.0
func (h *FileHandler) Level() Level
Level returns the current logging level
func (*FileHandler) LevelString ¶ added in v0.3.0
func (h *FileHandler) LevelString() string
LevelString returns the current logging level as a string
func (*FileHandler) RecordLog ¶ added in v0.2.0
func (h *FileHandler) RecordLog(message string, i []interface{}, logLvl Level, lineno string, name string, datetime time.Time)
RecordLog records the log to the stdout stream
func (*FileHandler) SetFormatter ¶ added in v0.2.0
func (h *FileHandler) SetFormatter(f Formatter)
SetFormatter sets the formatter for the handler to use
func (*FileHandler) SetLevel ¶ added in v0.2.0
func (h *FileHandler) SetLevel(lvl Level)
SetLevel sets the level the handler uses
type Formatter ¶
type Formatter interface {
Format(message string, levelname string, lineno string, name string, datetime time.Time) string
}
Formatter is an interface for the Formatter used by logging
type Handler ¶
type Handler interface { RecordLog(message string, i []interface{}, logLvl Level, lineno string, name string, datetime time.Time) SetLevel(level Level) SetFormatter(f Formatter) Level() Level LevelString() string }
Handler is an interface for the Handlers used by logging
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the basic unit of logging
var RootLogger *Logger
RootLogger is the parent of all Loggers
func (*Logger) AddHandler ¶
AddHandler adds the provided handler to the Logger
func (*Logger) Critical ¶
Critical records a log record using a format string with level of Critical and then calls os.Exit(1).
func (*Logger) NewLogger ¶ added in v0.7.0
NewLogger creates a new logger instance and sets this logger as a parent.
type StandardFormatter ¶
type StandardFormatter struct {
FormatString string
}
StandardFormatter is the in-library implementation of the Formatter interface
type StdoutHandler ¶
type StdoutHandler struct {
// contains filtered or unexported fields
}
StdoutHandler is an implementation of the Handler interface that directs to stdout
func NewStdoutHandler ¶ added in v0.2.0
func NewStdoutHandler() StdoutHandler
NewStdoutHandler returns an instantiated StdoutHandler type
func (*StdoutHandler) Level ¶ added in v0.3.0
func (h *StdoutHandler) Level() Level
Level returns the current logging level
func (*StdoutHandler) LevelString ¶ added in v0.3.0
func (h *StdoutHandler) LevelString() string
LevelString returns the current logging level as a string
func (*StdoutHandler) RecordLog ¶
func (h *StdoutHandler) RecordLog(message string, i []interface{}, logLvl Level, lineno string, name string, datetime time.Time)
RecordLog records the log to the stdout stream
func (*StdoutHandler) SetFormatter ¶
func (h *StdoutHandler) SetFormatter(f Formatter)
SetFormatter sets the formatter for the handler to use
func (*StdoutHandler) SetLevel ¶
func (h *StdoutHandler) SetLevel(lvl Level)
SetLevel sets the level the handler uses