Documentation
¶
Overview ¶
Example (Bugsnag) ¶
logger := logur.NoopLogger{} // choose an actual implementation bugsnag.New(bugsnag.Configuration{ Logger: logur.NewErrorPrintLogger(logger), })
Output:
Example (GoKitLog) ¶
logger := logur.NoopLogger{} // choose an actual implementation log.With(kitintegration.New(logger), "key", "value")
Output:
Example (GrpcLog) ¶
logger := logur.NoopLogger{} // choose an actual implementation grpclog.SetLoggerV2(grpcintegration.New(logger))
Output:
Example (MysqlDriver) ¶
logger := logur.NoopLogger{} // choose an actual implementation _ = mysql.SetLogger(logur.NewErrorPrintLogger(logger))
Output:
Example (Rollbar) ¶
logger := logur.NoopLogger{} // choose an actual implementation clientLogger := logur.NewErrorPrintLogger(logger) rollbar.SetLogger(clientLogger) // OR notifier := rollbar.New("token", "environment", "version", "host", "root") notifier.SetLogger(clientLogger)
Output:
Index ¶
- type Logger
- type LoggerAdapter
- func (l *LoggerAdapter) Debug(msg string, fields ...map[string]interface{})
- func (l *LoggerAdapter) Error(msg string, fields ...map[string]interface{})
- func (l *LoggerAdapter) Info(msg string, fields ...map[string]interface{})
- func (l *LoggerAdapter) Trace(msg string, fields ...map[string]interface{})
- func (l *LoggerAdapter) Warn(msg string, fields ...map[string]interface{})
- func (l *LoggerAdapter) WithFields(fields map[string]interface{}) Logger
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { Trace(msg string, fields ...map[string]interface{}) Debug(msg string, fields ...map[string]interface{}) Info(msg string, fields ...map[string]interface{}) Warn(msg string, fields ...map[string]interface{}) Error(msg string, fields ...map[string]interface{}) // WithFields annotates a logger with some context and it as a new instance. WithFields(fields map[string]interface{}) Logger }
Logger is the fundamental interface for all log operations.
type LoggerAdapter ¶
type LoggerAdapter struct {
// contains filtered or unexported fields
}
LoggerAdapter wraps a logur logger and exposes it under a custom interface.
func NewLoggerAdapter ¶
func NewLoggerAdapter(logger logur.Logger) *LoggerAdapter
NewLoggerAdapter returns a new Logger instance.
func (*LoggerAdapter) Debug ¶
func (l *LoggerAdapter) Debug(msg string, fields ...map[string]interface{})
Debug logs a debug event.
func (*LoggerAdapter) Error ¶
func (l *LoggerAdapter) Error(msg string, fields ...map[string]interface{})
Error logs an error event.
func (*LoggerAdapter) Info ¶
func (l *LoggerAdapter) Info(msg string, fields ...map[string]interface{})
Info logs an info event.
func (*LoggerAdapter) Trace ¶
func (l *LoggerAdapter) Trace(msg string, fields ...map[string]interface{})
Trace logs a trace event.
func (*LoggerAdapter) Warn ¶
func (l *LoggerAdapter) Warn(msg string, fields ...map[string]interface{})
Warn logs a warning event.
func (*LoggerAdapter) WithFields ¶
func (l *LoggerAdapter) WithFields(fields map[string]interface{}) Logger
WithFields annotates a logger with some context and it as a new instance.
Click to show internal directories.
Click to hide internal directories.