Documentation
¶
Index ¶
- Constants
- Variables
- func AddLogger(writer io.Writer)
- func FromFile(ctx context.Context, logfile string, level zerolog.Level, ...) (lastMsg string)
- func GetLogger() *zerolog.Logger
- func LastMsgFromFile(logfile string, format ...func([]byte) (string, error)) (lastMsg string, err error)
- func RedactEnv(v any) any
- func SetLevel(level string)
- func SetLogger(writer io.Writer)
- func StreamLogger() grpc.StreamServerInterceptor
- func UnaryLogger() grpc.UnaryServerInterceptor
- type LineInfoHook
- type LogWriter
Constants ¶
View Source
const ( ZEROLOG_TIME_FORMAT_DEFAULT = time.RFC3339Nano // zerolog's default format for With().Timestamp() LOG_TIME_FORMAT = time.TimeOnly LOG_CALLER_SKIP = 3 // stack frame depth )
Variables ¶
View Source
var ( Level = zerolog.Disabled GlobalWriter io.Writer ConsoleWriter = zerolog.ConsoleWriter{ Out: os.Stdout, TimeFormat: LOG_TIME_FORMAT, TimeLocation: time.Local, } )
Functions ¶
func FromFile ¶ added in v0.9.264
func FromFile(ctx context.Context, logfile string, level zerolog.Level, format ...func([]byte) (string, error)) (lastMsg string)
Log messages from a file. Can provide an arbitrary format function to format the log message. Noop if the current log level is higher than the provided level
func LastMsgFromFile ¶ added in v0.9.264
func StreamLogger ¶
func StreamLogger() grpc.StreamServerInterceptor
func UnaryLogger ¶
func UnaryLogger() grpc.UnaryServerInterceptor
TODO NR - this needs a deep copy to properly redact
Types ¶
type LineInfoHook ¶
type LineInfoHook struct{}
Click to show internal directories.
Click to hide internal directories.