Documentation ¶
Index ¶
- type ConfigOption
- type Logger
- type LogrusLogger
- func (l LogrusLogger) Debug(msg string, fields ...interface{})
- func (l LogrusLogger) Error(msg string, fields ...interface{})
- func (l LogrusLogger) Info(msg string, fields ...interface{})
- func (l LogrusLogger) SetDefaultFields(defaultFields map[string]string)
- func (l LogrusLogger) SetLevel(levelName string)
- func (l LogrusLogger) SetLogJSON(value bool)
- func (l LogrusLogger) Trace(msg string, fields ...interface{})
- func (l LogrusLogger) Warn(msg string, fields ...interface{})
- type MockLogger
- func (l MockLogger) Debug(msg string, fields ...interface{})
- func (l MockLogger) Error(msg string, fields ...interface{})
- func (l MockLogger) Info(msg string, fields ...interface{})
- func (l MockLogger) SetLevel(logLevel string)
- func (l MockLogger) Trace(msg string, fields ...interface{})
- func (l MockLogger) Warn(msg string, fields ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigOption ¶
type ConfigOption func(*LogrusLogger)
func ConfigLoggerInstance ¶
func ConfigLoggerInstance(logger *log.Logger) ConfigOption
type Logger ¶
type Logger interface { Error(string, ...interface{}) Warn(string, ...interface{}) Info(string, ...interface{}) Debug(string, ...interface{}) Trace(string, ...interface{}) SetLevel(string) }
Logger interface implements a simple logger.
type LogrusLogger ¶
type LogrusLogger struct {
// contains filtered or unexported fields
}
LogrusLogger is a logger based on logrus.
func NewLogrusLogger ¶
func NewLogrusLogger(opts ...ConfigOption) *LogrusLogger
NewLogrusLogger creates a new structured logger.
func (LogrusLogger) Debug ¶
func (l LogrusLogger) Debug(msg string, fields ...interface{})
Debug logs a debug message.
func (LogrusLogger) Error ¶
func (l LogrusLogger) Error(msg string, fields ...interface{})
Error logs an error message.
func (LogrusLogger) Info ¶
func (l LogrusLogger) Info(msg string, fields ...interface{})
Info logs an info message.
func (LogrusLogger) SetDefaultFields ¶
func (l LogrusLogger) SetDefaultFields(defaultFields map[string]string)
SetDefaultFields sets fields to be logged on every use of the logger.
func (LogrusLogger) SetLevel ¶
func (l LogrusLogger) SetLevel(levelName string)
SetLevel allows the log level to be set.
func (LogrusLogger) SetLogJSON ¶
func (l LogrusLogger) SetLogJSON(value bool)
LogJSON determines whether or not to format the logs as JSON.
func (LogrusLogger) Trace ¶
func (l LogrusLogger) Trace(msg string, fields ...interface{})
Trace logs a trace message.
func (LogrusLogger) Warn ¶
func (l LogrusLogger) Warn(msg string, fields ...interface{})
Warn logs an warning message.
type MockLogger ¶
type MockLogger struct {
// contains filtered or unexported fields
}
func NewMockLogger ¶
func NewMockLogger(t *testing.T) *MockLogger
func (MockLogger) Debug ¶
func (l MockLogger) Debug(msg string, fields ...interface{})
Debug logs a debug message.
func (MockLogger) Error ¶
func (l MockLogger) Error(msg string, fields ...interface{})
Error logs an error message.
func (MockLogger) Info ¶
func (l MockLogger) Info(msg string, fields ...interface{})
Info logs an info message.
func (MockLogger) SetLevel ¶
func (l MockLogger) SetLevel(logLevel string)
func (MockLogger) Trace ¶
func (l MockLogger) Trace(msg string, fields ...interface{})
Trace logs a trace message.
func (MockLogger) Warn ¶
func (l MockLogger) Warn(msg string, fields ...interface{})
Warn logs an warning message.
Click to show internal directories.
Click to hide internal directories.