Documentation
¶
Index ¶
- type LogChainer
- type LogKey
- type LogLevel
- type Logger
- func (l *Logger) CodeID(c string) LogChainer
- func (l *Logger) Debug(msg string)
- func (l *Logger) ElapsedTime(dur time.Duration) LogChainer
- func (l *Logger) Error(msg string, err error)
- func (l *Logger) Fatal(msg string, err error)
- func (l *Logger) Info(msg string)
- func (l *Logger) Panic(msg string)
- func (l *Logger) Signal(s string) LogChainer
- func (l *Logger) Warn(msg string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogChainer ¶
type LogChainer interface {
ElapsedTime(dur time.Duration) LogChainer
CodeID(c string) LogChainer
Signal(s string) LogChainer
// These are the last functions that should be called on a log chain.
// These will execute and log all the information
Panic(msg string)
Fatal(msg string, err error)
Error(msg string, err error)
Warn(msg string)
Info(msg string)
Debug(msg string)
}
LogChainer defines the behavior of the logger. Exposes a function for each loggable field which maps to a LogKey. The functions invocations can be chained and terminated by one of the levelled function calls (Fatal, Error, Warn, Info).
type LogKey ¶
type LogKey string
LogKey is the type each key that appears in the log should be.
type Logger ¶
Logger implements the LogChainer interface and relies on http://github.com/rs/zerolog
func GetLogger ¶
GetLogger returns a pointer to a Logger that logs from logLevel and above. The logger is instructed to include in each log message the name of the service received in input.
func (*Logger) CodeID ¶
func (l *Logger) CodeID(c string) LogChainer
CodeID instructs the logger to log the input code.
func (*Logger) Debug ¶
Debug logs the message at debug level. The log payload will contain everything else the logger has been instructed to log.
func (*Logger) ElapsedTime ¶
func (l *Logger) ElapsedTime(dur time.Duration) LogChainer
ElapsedTime instructs the logger to log the input duration.
func (*Logger) Error ¶
Error logs the message and the error at error level. The log payload will contain everything else the logger has been instructed to log.
func (*Logger) Fatal ¶
Fatal logs the message and the error at fatal level. It after exits with os.Exit(1). The log payload will contain everything else the logger has been instructed to log.
func (*Logger) Info ¶
Info logs the message at info level. The log payload will contain everything else the logger has been instructed to log.
func (*Logger) Panic ¶
Panic logs the message at panic level. It stops the ordinary flow of a goroutine. The log payload will contain everything else the logger has been instructed to log.
func (*Logger) Signal ¶
func (l *Logger) Signal(s string) LogChainer
Signal instructs the logger to log the input code.