Documentation
¶
Index ¶
- Variables
- func Configure(level, format, outfile string)
- func Debug(msg string, fields ...Field)
- func Error(msg string, fields ...Field)
- func Fatal(msg string, fields ...Field)
- func Info(msg string, fields ...Field)
- func SetClient(name string, cfg *Config) error
- type Config
- type Configurer
- type Field
- type LogLeveler
- type Logger
- type LogrusLogger
- func (l *LogrusLogger) Configure(cfg *Config) error
- func (l *LogrusLogger) Debug(msg string, fields ...Field)
- func (l *LogrusLogger) DebugL(msgs []string, fields ...Field)
- func (l *LogrusLogger) Error(msg string, fields ...Field)
- func (l *LogrusLogger) ErrorL(msgs []string, fields ...Field)
- func (l *LogrusLogger) Fatal(msg string, fields ...Field)
- func (l *LogrusLogger) FatalL(msgs []string, fields ...Field)
- func (l *LogrusLogger) Info(msg string, fields ...Field)
- func (l *LogrusLogger) InfoL(msgs []string, fields ...Field)
- func (l *LogrusLogger) Name() string
- func (l *LogrusLogger) Path() string
- type NullLogger
- func (NullLogger) Configure(*Config) error
- func (NullLogger) Debug(string, ...Field)
- func (NullLogger) DebugL([]string, ...Field)
- func (NullLogger) Error(string, ...Field)
- func (NullLogger) ErrorL([]string, ...Field)
- func (NullLogger) Fatal(string, ...Field)
- func (NullLogger) FatalL([]string, ...Field)
- func (NullLogger) Info(string, ...Field)
- func (NullLogger) InfoL([]string, ...Field)
- func (NullLogger) Name() string
- func (NullLogger) Path() string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrField is a shortcut function for adding an error field to the log output ErrField = func(e error) Field { return F("err", e) } )
Functions ¶
Types ¶
type Config ¶
type Config struct {
LogLevel string // Debug | Info | Error
OutFormat string // json | text
Outfile string // path to file. Missing = send to stdout/err
}
Config is the concrete type that is passed to a Configurer
type Configurer ¶
Configurer defines the interface to configure logging clients
type LogLeveler ¶
type LogLeveler interface {
Debug(string, ...Field)
DebugL([]string, ...Field)
Info(string, ...Field)
InfoL([]string, ...Field)
Error(string, ...Field)
ErrorL([]string, ...Field)
Fatal(string, ...Field)
FatalL([]string, ...Field)
}
LogLeveler defines the interface for log level methods
type Logger ¶
type Logger interface {
Name() string
Path() string
Configurer
LogLeveler
}
Logger defines the interface for logging clients
type LogrusLogger ¶
type LogrusLogger struct {
// contains filtered or unexported fields
}
LogrusLogger defines a logger using the logrus package as its backend
func NewLogrusLogger ¶
func NewLogrusLogger(cfg *Config) (*LogrusLogger, error)
NewLogrusLogger wraps a logrus client
func (*LogrusLogger) Configure ¶
func (l *LogrusLogger) Configure(cfg *Config) error
Configure permits configuration of the logger via a Config struct
func (*LogrusLogger) Debug ¶
func (l *LogrusLogger) Debug(msg string, fields ...Field)
Debug defines the debug level for this logger
func (*LogrusLogger) DebugL ¶
func (l *LogrusLogger) DebugL(msgs []string, fields ...Field)
DebugL defines the debug level for more than one log line
func (*LogrusLogger) Error ¶
func (l *LogrusLogger) Error(msg string, fields ...Field)
Error defines the error level for this logger
func (*LogrusLogger) ErrorL ¶
func (l *LogrusLogger) ErrorL(msgs []string, fields ...Field)
ErrorL defines the error level for more than one log line
func (*LogrusLogger) Fatal ¶
func (l *LogrusLogger) Fatal(msg string, fields ...Field)
Fatal defines the fatal level for this logger
func (*LogrusLogger) FatalL ¶
func (l *LogrusLogger) FatalL(msgs []string, fields ...Field)
FatalL defines the fatal level for more than one log line
func (*LogrusLogger) Info ¶
func (l *LogrusLogger) Info(msg string, fields ...Field)
Info defines the info level for this logger
func (*LogrusLogger) InfoL ¶
func (l *LogrusLogger) InfoL(msgs []string, fields ...Field)
InfoL defines the info level for more than one log line
func (*LogrusLogger) Path ¶
func (l *LogrusLogger) Path() string
Path returns the full path to the logger output, or empty string if logging is not going to a file
type NullLogger ¶
type NullLogger struct{}
NullLogger does nothing
func NewNullLogger ¶
func NewNullLogger(cfg *Config) (*NullLogger, error)
NewNullLogger creates a new NullLogger
func (NullLogger) Configure ¶
func (NullLogger) Configure(*Config) error
Configure permits configuration of the logger via a Config struct
func (NullLogger) Debug ¶
func (NullLogger) Debug(string, ...Field)
Debug defines the debug level for this logger
func (NullLogger) DebugL ¶
func (NullLogger) DebugL([]string, ...Field)
DebugL defines the debug level for this logger
func (NullLogger) Error ¶
func (NullLogger) Error(string, ...Field)
Error defines the error level for this logger
func (NullLogger) ErrorL ¶
func (NullLogger) ErrorL([]string, ...Field)
ErrorL defines the error level for this logger
func (NullLogger) Fatal ¶
func (NullLogger) Fatal(string, ...Field)
Fatal defines the fatal level for this logger
func (NullLogger) FatalL ¶
func (NullLogger) FatalL([]string, ...Field)
FatalL defines the fatal level for this logger
func (NullLogger) Info ¶
func (NullLogger) Info(string, ...Field)
Info defines the info level for this logger
func (NullLogger) InfoL ¶
func (NullLogger) InfoL([]string, ...Field)
InfoL defines the info level for this logger
func (NullLogger) Path ¶
func (NullLogger) Path() string
Path returns the path to the logger output file