Documentation ¶
Overview ¶
Package log provides global logging functions to be used throughout the charon app. It supports contextual logging via WithCtx and structured logging and structured errors via z.Field.
Index ¶
- func Debug(ctx context.Context, msg string, fields ...z.Field)
- func Error(ctx context.Context, msg string, err error, fields ...z.Field)
- func Info(ctx context.Context, msg string, fields ...z.Field)
- func InitJSONLogger() error
- func InitLoggerForT(_ *testing.T, encConfig zapcore.EncoderConfig, ws zapcore.WriteSyncer)
- func Warn(ctx context.Context, msg string, fields ...z.Field)
- func WithCtx(ctx context.Context, fields ...z.Field) context.Context
- func WithTopic(ctx context.Context, component string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug logs the message and fields (incl fields in the context) at Debug level. TODO(corver): Add indication of when debug should be used.
func Error ¶
Error wraps err with msg and fields and logs it (incl fields in the context) at Error level. TODO(corver): Add indication of when error should be used.
func Info ¶
Info logs the message and fields (incl fields in the context) at Info level. TODO(corver): Add indication of when info should be used.
func InitJSONLogger ¶
func InitJSONLogger() error
InitJSONLogger initialises a JSON logger for production usage.
func InitLoggerForT ¶
func InitLoggerForT(_ *testing.T, encConfig zapcore.EncoderConfig, ws zapcore.WriteSyncer)
InitLoggerForT initialises a console logger for testing purposes.
func Warn ¶
Warn logs the message and fields (incl fields in the context) at Warn level. TODO(corver): Add indication of when warn should be used.
Types ¶
This section is empty.