Documentation
¶
Index ¶
- type FastLogger
- func (l *FastLogger) Debug(msg string)
- func (l *FastLogger) Error(msg string, err error)
- func (l *FastLogger) Event(p string) Logger
- func (l *FastLogger) Fatal(msg string, err error)
- func (l *FastLogger) Info(msg string)
- func (l *FastLogger) Panic(msg string)
- func (l *FastLogger) RequestID(id strfmt.UUID) Logger
- func (l *FastLogger) Signal(sig fmt.Stringer) Logger
- func (l *FastLogger) StatusCode(sc int) Logger
- func (l *FastLogger) Warn(msg string)
- type LogKey
- type LogLevel
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FastLogger ¶
type FastLogger struct {
// contains filtered or unexported fields
}
FastLogger implements the LogChainer interface and relies on http://github.com/rs/zerolog
func GetConsoleLogger ¶
func GetConsoleLogger(service string, logLevel LogLevel) *FastLogger
GetConsoleLogger returns a pointer to a Logger that logs from logLevel and above to standard output in colorised human readable format. The logger is instructed to include in each log message the name of the service received in input.
func GetLogger ¶
func GetLogger(service string, logLevel LogLevel) *FastLogger
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 GetLoggerString ¶
func GetLoggerString(service string, logLevel string) *FastLogger
GetLoggerString - alternative Logger constructor that returns a pointer to a Logger based on a string defining a log level. The default value is INFO.
func (*FastLogger) Debug ¶
func (l *FastLogger) Debug(msg string)
Debug logs the message at debug level. The log payload will contain everything else the logger has been instructed to log.
func (*FastLogger) Error ¶
func (l *FastLogger) Error(msg string, err 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 (*FastLogger) Event ¶
func (l *FastLogger) Event(p string) Logger
Event instructs the logger to log the event.
func (*FastLogger) Fatal ¶
func (l *FastLogger) Fatal(msg string, err error)
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 (*FastLogger) Info ¶
func (l *FastLogger) Info(msg string)
Info logs the message at info level. The log payload will contain everything else the logger has been instructed to log.
func (*FastLogger) Panic ¶
func (l *FastLogger) Panic(msg string)
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 (*FastLogger) RequestID ¶
func (l *FastLogger) RequestID(id strfmt.UUID) Logger
RequestID instructs the logger to log the request ID.
func (*FastLogger) Signal ¶
func (l *FastLogger) Signal(sig fmt.Stringer) Logger
Signal instructs the logger to log the signal.
func (*FastLogger) StatusCode ¶
func (l *FastLogger) StatusCode(sc int) Logger
StatusCode instructs the logger to log the status code.
func (*FastLogger) Warn ¶
func (l *FastLogger) Warn(msg string)
Warn logs the message at warning level. The log payload will contain everything else the logger has been instructed to log.
type LogLevel ¶
type LogLevel int
LogLevel represents the logging level.
func ParseLogLevel ¶
ParseLogLevel parses the input string and returns the respective log level.
type Logger ¶
type Logger interface { Event(string) Logger RequestID(strfmt.UUID) Logger StatusCode(int) Logger Signal(fmt.Stringer) Logger // 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) }
Logger 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).