Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGoLogWriter ¶ added in v0.9.1
NewGoLogWriter creates an adapter for the go logger that writes using the Log method of the logger.
Types ¶
type Config ¶ added in v0.9.3
type Config struct {
// Level describes the minimum level to log at
Level Level `json:"level" yaml:"level" default:"notice"`
// Format describes the log message format
Format Format `json:"format" yaml:"format" default:"ljson"`
}
Config describes the logging settings.
type Formatter ¶ added in v0.9.3
type Formatter interface {
// Format a string message. The module may be empty.
Format(level Level, module string, message string) []byte
// Format a data object. The module may be empty.
FormatData(level Level, module string, data interface{}) []byte
}
Formatter an interface that can format a log message or a data interface into a data stream.
func NewLJsonLogFormatter ¶ added in v0.9.3
func NewLJsonLogFormatter() Formatter
NewLJsonLogFormatter Factory for the newline-delimited JSON formatter.
func NewTextLogFormatter ¶ added in v0.9.3
func NewTextLogFormatter() Formatter
NewTextLogFormatter Factory for the text format.
type Level ¶
type Level int8
Level syslog-style log level identifiers
const ( LevelDebug Level = 7 LevelInfo Level = 6 LevelNotice Level = 5 LevelWarning Level = 4 LevelError Level = 3 LevelCritical Level = 2 LevelAlert Level = 1 LevelEmergency Level = 0 )
Supported values for Level
func (Level) String ¶
func (level Level) String() (LevelString, error)
String Convert the int level to the string representation
type LevelString ¶
type LevelString string
LevelString is a type for supported log level strings
const ( LevelDebugString LevelString = "debug" LevelInfoString LevelString = "info" LevelNoticeString LevelString = "notice" LevelWarningString LevelString = "warning" LevelErrorString LevelString = "error" LevelCriticalString LevelString = "crit" LevelAlertString LevelString = "alert" LevelEmergencyString LevelString = "emerg" )
List of valid string values for log levels
func (LevelString) ToLevel ¶
func (level LevelString) ToLevel() (Level, error)
ToLevel convert the string level to the int representation
type Logger ¶
type Logger interface {
// SetLevel sets the logging level of the current logger.
SetLevel(level Level)
Debug(message string)
Debuge(err error)
Debugd(data interface{})
Debugf(format string, args ...interface{})
Info(message string)
Infoe(err error)
Infod(data interface{})
Infof(format string, args ...interface{})
Notice(message string)
Noticee(err error)
Noticed(data interface{})
Noticef(format string, args ...interface{})
Warning(message string)
Warninge(err error)
Warningd(data interface{})
Warningf(format string, args ...interface{})
Error(message string)
Errore(err error)
Errord(data interface{})
Errorf(format string, args ...interface{})
Critical(message string)
Criticale(err error)
Criticald(data interface{})
Criticalf(format string, args ...interface{})
Alert(message string)
Alerte(err error)
Alertd(data interface{})
Alertf(format string, args ...interface{})
Emergency(message string)
Emergencye(err error)
Emergencyd(data interface{})
Emergencyf(format string, args ...interface{})
Log(...interface{})
}
Logger The logger interface provides logging facilities on various levesl
type LoggerFactory ¶
type LoggerFactory interface {
// Make creates a new logger with the specified configuration and module.
//
// - config is the configuration structure.
// - module is the module that's logging. Can be empty.
//
// Return:
//
// - Logger is the logger created.
// - error is returned if the configuration was invalid.
Make(config Config, module string) (Logger, error)
}
LoggerFactory is a factory to create a logger on demand
func NewFactory ¶ added in v0.9.3
func NewFactory(writer io.Writer) LoggerFactory
NewFactory creates a standard logger pipeline factory.
- writer is the target writer.
goland:noinspection GoUnusedExportedFunction
func NewLoggerPipelineFactory ¶ added in v0.9.3
func NewLoggerPipelineFactory(writer io.Writer) LoggerFactory
NewLoggerPipelineFactory create a pipeline logger factory