Documentation ¶
Index ¶
- func Ctx(ctx context.Context, logger Logger) context.Context
- func GetCallerFrame(skip int) runtime.Frame
- func SetGlobalLevel(l Level)
- func ToJSON(v interface{}) string
- func ToPrettyJSON(v interface{}) string
- func ToYAML(v interface{}) string
- type KeyType
- type Level
- type Logger
- type NoOpLogger
- func (*NoOpLogger) Debug(args ...interface{})
- func (*NoOpLogger) Debugf(format string, args ...interface{})
- func (*NoOpLogger) Error(args ...interface{})
- func (*NoOpLogger) Errorf(format string, args ...interface{})
- func (l *NoOpLogger) GetLevel() *Level
- func (*NoOpLogger) Info(args ...interface{})
- func (*NoOpLogger) Infof(format string, args ...interface{})
- func (l *NoOpLogger) ResetLevel()
- func (l *NoOpLogger) SetLevel(_ Level)
- func (*NoOpLogger) Trace(args ...interface{})
- func (*NoOpLogger) Tracef(format string, args ...interface{})
- func (*NoOpLogger) Warn(args ...interface{})
- func (*NoOpLogger) Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCallerFrame ¶
func ToPrettyJSON ¶
func ToPrettyJSON(v interface{}) string
Types ¶
type Level ¶
type Level uint8
Level represents the logging level.
func GetGlobalLevel ¶
func GetGlobalLevel() Level
GetGlobalLevel retrieves the current global logging level.
type Logger ¶
type Logger interface { // SetLevel sets the logging level for this specific Logger; if present, it overrides the global logging level. SetLevel(level Level) // GetLevel returns the current logging level for this specific Logger, or nil if no level is set. GetLevel() *Level // ResetLevel removes the per-logger level from this specific Logger, if present. ResetLevel() // Trace sends out a debug message with the given arguments to the logger. Trace(args ...interface{}) // Tracef formats a debug message using the given arguments and sends it to the logger. Tracef(format string, args ...interface{}) // Debug sends out a debug message with the given arguments to the logger. Debug(args ...interface{}) // Debugf formats a debug message using the given arguments and sends it to the logger. Debugf(format string, args ...interface{}) // Info sends out an informational message with the given arguments to the logger. Info(args ...interface{}) // Infof formats an informational message using the given arguments and sends it to the logger. Infof(format string, args ...interface{}) // Warn sends out a warning message with the given arguments to the logger. Warn(args ...interface{}) // Warnf formats a warning message using the given arguments and sends it to the logger. Warnf(format string, args ...interface{}) // Error sends out an error message with the given arguments to the logger. Error(args ...interface{}) // Errorf formats an error message using the given arguments and sends it to the logger. Errorf(format string, args ...interface{}) }
Logger is the common interface to all loggers.
func FromContext ¶
FromContext returns the logger that was recorded in the context, if any.
type NoOpLogger ¶
type NoOpLogger struct{}
NoOpLogger is a logger that writes nothing.
func (*NoOpLogger) Debug ¶
func (*NoOpLogger) Debug(args ...interface{})
Debug logs a message at LevelDebug level.
func (*NoOpLogger) Debugf ¶
func (*NoOpLogger) Debugf(format string, args ...interface{})
Debugf logs a message at LevelDebug level.
func (*NoOpLogger) Error ¶
func (*NoOpLogger) Error(args ...interface{})
Error logs a message at LevelError level.
func (*NoOpLogger) Errorf ¶
func (*NoOpLogger) Errorf(format string, args ...interface{})
Errorf logs a message at LevelError level.
func (*NoOpLogger) Info ¶
func (*NoOpLogger) Info(args ...interface{})
Info logs a message at LevelInfo level.
func (*NoOpLogger) Infof ¶
func (*NoOpLogger) Infof(format string, args ...interface{})
Infof logs a message at LevelInfo level.
func (*NoOpLogger) Trace ¶
func (*NoOpLogger) Trace(args ...interface{})
Trace logs a message at LevelTrace level.
func (*NoOpLogger) Tracef ¶
func (*NoOpLogger) Tracef(format string, args ...interface{})
Tracef logs a message at LevelTrace level.
func (*NoOpLogger) Warn ¶
func (*NoOpLogger) Warn(args ...interface{})
Warn logs a message at LevelWarn level.
func (*NoOpLogger) Warnf ¶
func (*NoOpLogger) Warnf(format string, args ...interface{})
Warnf logs a message at LevelWarn level.