Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, msg string, keysAndValues ...interface{})
- func Dump(msg string, v ...interface{})
- func Error(ctx context.Context, msg string, keysAndValues ...interface{})
- func Info(ctx context.Context, msg string, keysAndValues ...interface{})
- func IsDebug(ctx context.Context) bool
- func Panic(ctx context.Context, msg string, keysAndValues ...interface{})
- func SetGlobalLogger(l Logger)
- func Truncate(str string, length int, concat string) string
- func Warn(ctx context.Context, msg string, keysAndValues ...interface{})
- type ContextMapper
- type Logger
- type ThrottleLogger
- func (t *ThrottleLogger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})
- func (t *ThrottleLogger) Dump(msg string, v ...interface{})
- func (t *ThrottleLogger) Error(ctx context.Context, msg string, keysAndValues ...interface{})
- func (t *ThrottleLogger) Flush()
- func (t *ThrottleLogger) Info(ctx context.Context, msg string, keysAndValues ...interface{})
- func (t *ThrottleLogger) IsDebug(ctx context.Context) bool
- func (t *ThrottleLogger) Panic(ctx context.Context, msg string, keysAndValues ...interface{})
- func (t *ThrottleLogger) Stop()
- func (t *ThrottleLogger) Warn(ctx context.Context, msg string, keysAndValues ...interface{})
Constants ¶
View Source
const ( AppName = "app_name" AppVersion = "app_version" )
View Source
const ( DebugLevel = iota InfoLevel WarnLevel ErrorLevel PanicLevel )
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
func Dump(msg string, v ...interface{})
Dump should be used only during development and should not stay in production code.
func SetGlobalLogger ¶
func SetGlobalLogger(l Logger)
SetGlobalLogger sets the Logger instance used in global scope. Must be called during initialization as early as possible. It's not thread safe.
Types ¶
type ContextMapper ¶
ContextMapper is an interface that returns Values which should be included in the log fields.
type Logger ¶
type Logger interface { Debug(ctx context.Context, msg string, keysAndValues ...interface{}) Info(ctx context.Context, msg string, keysAndValues ...interface{}) Warn(ctx context.Context, msg string, keysAndValues ...interface{}) Error(ctx context.Context, msg string, keysAndValues ...interface{}) Panic(ctx context.Context, msg string, keysAndValues ...interface{}) IsDebug(ctx context.Context) bool // Dump should be used only during development and should not stay in production code. Dump(msg string, v ...interface{}) }
Logger is an interface that wraps the most common logging methods. Correlation related information like the Correlation-Id and Workflow-Id will be extracted from the passed Context.
func GlobalLogger ¶
func GlobalLogger() Logger
GlobalLogger gets the Logger instance used in global scope. It's not thread safe.
type ThrottleLogger ¶
type ThrottleLogger struct {
// contains filtered or unexported fields
}
func Throttle ¶
func Throttle(logger Logger, interval time.Duration) (*ThrottleLogger, chan struct{})
func (*ThrottleLogger) Debug ¶
func (t *ThrottleLogger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})
func (*ThrottleLogger) Dump ¶
func (t *ThrottleLogger) Dump(msg string, v ...interface{})
Dump should be used only during development and should not stay in production code.
func (*ThrottleLogger) Error ¶
func (t *ThrottleLogger) Error(ctx context.Context, msg string, keysAndValues ...interface{})
func (*ThrottleLogger) Flush ¶
func (t *ThrottleLogger) Flush()
func (*ThrottleLogger) Info ¶
func (t *ThrottleLogger) Info(ctx context.Context, msg string, keysAndValues ...interface{})
func (*ThrottleLogger) Panic ¶
func (t *ThrottleLogger) Panic(ctx context.Context, msg string, keysAndValues ...interface{})
func (*ThrottleLogger) Stop ¶
func (t *ThrottleLogger) Stop()
Directories ¶
Path | Synopsis |
---|---|
Package color adds coloring functionality for TTY output.
|
Package color adds coloring functionality for TTY output. |
Click to show internal directories.
Click to hide internal directories.