Documentation
¶
Index ¶
- Constants
- type ILogger
- type Logger
- func (l *Logger) Debug(msg string, keysAndValues ...interface{})
- func (l *Logger) Error(msg string, keysAndValues ...interface{})
- func (l *Logger) Fatal(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(msg string, keysAndValues ...interface{})
- func (l *Logger) Panic(msg string, keysAndValues ...interface{})
- func (l *Logger) SetLevel(level logrus.Level) ILogger
- func (l *Logger) Warn(msg string, keysAndValues ...interface{})
- func (l *Logger) WithError(err error) ILogger
- func (l *Logger) WithValues(keysAndValues ...interface{}) ILogger
Constants ¶
View Source
const ( ErrorKey = "error" SpanIdLogKeyName = "spanID" TraceIdLogKeyName = "traceID" )
Keys used in log fields.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ILogger ¶
type ILogger interface {
// SetLevel sets the log level.
SetLevel(level logrus.Level) ILogger
// Debug logs debug message with the given key/value pairs as context.
Debug(msg string, keysAndValues ...interface{})
// Info logs info message with the given key/value pairs as context.
Info(msg string, keysAndValues ...interface{})
// Warn logs warning message with the given key/value pairs as context.
Warn(msg string, keysAndValues ...interface{})
// Error logs an error, with the given message and key/value pairs as context.
Error(msg string, keysAndValues ...interface{})
// Fatal logs fatal message with the given key/value pairs as context.
Fatal(msg string, keysAndValues ...interface{})
// Panic logs panic message with the given key/value pairs as context.
Panic(msg string, keysAndValues ...interface{})
// WithValues returns a new Logger with additional key/value pairs.
WithValues(keysAndValues ...interface{}) ILogger
// WithError returns a new Logger with additional error.
WithError(err error) ILogger
}
ILogger represents a logging interface.
type Logger ¶
Logger is a Logrus-based ILogger.
func (*Logger) Error ¶
Error logs a message at error level with optional fields. Sentry capture should happen explicitly where the error is handled using the context-aware hub.
func (*Logger) WithError ¶
WithError returns a new ILogger that includes the given error in the log context.
func (*Logger) WithValues ¶
WithValues returns a new ILogger with additional fields added to the entry.
Click to show internal directories.
Click to hide internal directories.