Versions in this module Expand all Collapse all v0 v0.1.2 Nov 4, 2026 v0.1.0 Nov 3, 2026 Changes in this version + const DownstreamDetailsKey + const DownstreamDurationMSKey + const DownstreamIDKey + const DownstreamTypeKey + const LogId + var DefaultJSONEncoder = JSONEncoder + var DefaultTextEncoder = TextEncoder + var ErrLevelControlUnsupported = errors.New("logit: logger does not support runtime level control") + var ErrLoggerCloseUnsupported = errors.New("logit: logger does not support close") + var ErrPanicLoggerNotConfigured = errors.New("logit: panic logger not configured") + func AddDebugField(ctx context.Context, fields ...Field) + func AddDownstreamDurationAuto(ctx context.Context, prefix string, duration time.Duration) + func AddField(ctx context.Context, fields ...Field) + func AddMeta(ctx context.Context, fields ...Field) + func CallerPath(skip int) string + func Close(l Logger) error + func Debug(ctx context.Context, msg string, fields ...Field) + func DebugEnabled(ctx context.Context) bool + func Error(ctx context.Context, msg string, fields ...Field) + func ErrorEnabled(ctx context.Context) bool + func Fatal(ctx context.Context, msg string, fields ...Field) + func HookStderr(w Writer) error + func HookStdout(w Writer) error + func Info(ctx context.Context, msg string, fields ...Field) + func InfoDuration(ctx context.Context, msg string, fields ...Field) + func InfoEnabled(ctx context.Context) bool + func LogIDFromContext(ctx context.Context) (string, bool) + func NewContextScope(parent context.Context) context.Context + func NewDurationScope(parent context.Context) context.Context + func NewLogID() string + func Output(ctx context.Context, level Level, callDepth int, msg string, fields ...Field) + func RecoverAndReport(ctx context.Context) + func ReportPanic(ctx context.Context, recovered any, fields ...Field) error + func SetDefault(l Logger) + func SetMinLevel(l Logger, level Level) error + func SetNamed(name string, l Logger) + func SetPanicLogger(w Writer) + func Warn(ctx context.Context, msg string, fields ...Field) + func WarnEnabled(ctx context.Context) bool + func WithContext(ctx context.Context) context.Context + func WithContextLogID(ctx context.Context) context.Context + func WithLoggerName(ctx context.Context, name string) context.Context + func WithStart(ctx context.Context) context.Context + type Encoder interface + AppendField func(buf []byte, f Field) []byte + AppendMessage func(buf []byte, msg string) []byte + AppendPrefix func(buf []byte, level Level, now time.Time, caller string) []byte + Finish func(buf []byte) []byte + type Field struct + Key string + func Any(key string, v any) Field + func Auto(key string, v any) Field + func Bool(key string, v bool) Field + func Defer(key string, fn func() Field) Field + func DownstreamFields(kind, id string, duration time.Duration, details map[string]any) []Field + func Dur(key string, v time.Duration) Field + func Err(err error) Field + func ErrKey(key string, err error) Field + func Float64(key string, v float64) Field + func Int(key string, v int) Field + func Int64(key string, v int64) Field + func Str(key string, v string) Field + func Time(key string, v time.Time) Field + func Uint64(key string, v uint64) Field + func (f Field) Type() FieldType + type FieldType uint8 + type JSONEncoder struct + func (JSONEncoder) AppendField(buf []byte, f Field) []byte + func (JSONEncoder) AppendMessage(buf []byte, msg string) []byte + func (JSONEncoder) AppendPrefix(buf []byte, level Level, now time.Time, caller string) []byte + func (JSONEncoder) Finish(buf []byte) []byte + type Level uint16 + const AllLevels + const DebugLevel + const ErrorLevel + const FatalLevel + const InfoLevel + const UnknownLevel + const WarnLevel + func ParseLevel(s string) (Level, error) + func (l Level) Is(lineLevel Level) bool + func (l Level) String() string + type LevelController interface + MinLevel func() Level + SetMinLevel func(Level) error + type Logger interface + Debug func(ctx context.Context, msg string, fields ...Field) + Enabled func(level Level) bool + Error func(ctx context.Context, msg string, fields ...Field) + Fatal func(ctx context.Context, msg string, fields ...Field) + Info func(ctx context.Context, msg string, fields ...Field) + Output func(ctx context.Context, level Level, callDepth int, msg string, fields ...Field) + Warn func(ctx context.Context, msg string, fields ...Field) + With func(fields ...Field) Logger + func Default() Logger + func LoggerFromContext(ctx context.Context) Logger + func MustNew(opts ...Option) Logger + func Named(name string) Logger + func New(opts ...Option) (Logger, error) + func PanicLogger() Logger + func With(fields ...Field) Logger + type Option func(*config) + func OptCaller(on bool) Option + func OptDispatch(targets ...Target) Option + func OptEncoder(enc Encoder) Option + func OptFileName(name string) Option + func OptFilterKeys(keys ...string) Option + func OptMinLevel(l Level) Option + func OptNoExit() Option + func OptOnWriteError(fn func(error)) Option + func OptWriter(w Writer) Option + type Target struct + Levels []Level + Writer Writer + type TextEncoder struct + func (TextEncoder) AppendField(buf []byte, f Field) []byte + func (TextEncoder) AppendMessage(buf []byte, msg string) []byte + func (TextEncoder) AppendPrefix(buf []byte, level Level, now time.Time, caller string) []byte + func (TextEncoder) Finish(buf []byte) []byte + type WriteErrorStats interface + LastWriteError func() error + WriteErrors func() int64 + type Writer interface + Close func() error + Write func(p []byte) (int, error) + WriterKey func() WriterKey + func NewWriter(w io.Writer) Writer + func OpenFile(path string) (Writer, error) + func Stderr() Writer + func Stdout() Writer + type WriterKey struct + func NewWriterKey() WriterKey