Documentation
¶
Index ¶
- Constants
- func ContextWithColorMode(ctx context.Context, noColor bool) context.Context
- func ContextWithDebugMode(ctx context.Context, debug bool) context.Context
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func ExtraDebug(msg string, args ...any)
- func ExtraDebugContext(ctx context.Context, msg string, args ...any)
- func Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func NewJSONHandler(w io.Writer, opts *slog.HandlerOptions) *slog.JSONHandler
- func NewTextHandler(w io.Writer, opts *slog.HandlerOptions) *slog.TextHandler
- func SetDefault(l *Logger)
- func Trace(msg string, args ...any)
- func TraceContext(ctx context.Context, msg string, args ...any)
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- type Level
- type Logger
- func (l *Logger) ExtraDebug(msg string, args ...any)
- func (l *Logger) ExtraDebugContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Trace(msg string, args ...any)
- func (l *Logger) TraceContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) With(args ...any) *Logger
Constants ¶
View Source
const ( // standard levels LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError // LevelExtraDebug is between Debug and Trace. It had extra information that's useful sometimes // but not as overwhelming as Trace. e.g. OTel logging is at this level. LevelExtraDebug = slog.LevelDebug - 1 // Trace is the most verbose level. It includes session logging and an enormous amount of detail from // buildkit on cache refs and cache queries. LevelTrace = slog.LevelDebug - 2 )
Variables ¶
This section is empty.
Functions ¶
func ContextWithColorMode ¶ added in v0.11.7
ContextWithDebugMode enables or disables color mode in the given context's OpenTelemetry baggage.
func ContextWithDebugMode ¶ added in v0.11.7
ContextWithDebugMode enables or disables debug mode in the given context's OpenTelemetry baggage.
func ExtraDebug ¶
func NewJSONHandler ¶
func NewJSONHandler(w io.Writer, opts *slog.HandlerOptions) *slog.JSONHandler
func NewTextHandler ¶
func NewTextHandler(w io.Writer, opts *slog.HandlerOptions) *slog.TextHandler
func SetDefault ¶
func SetDefault(l *Logger)
Types ¶
type Logger ¶
Logger wraps the slog.Logger type with support for a few additional levels
func PrettyLogger ¶ added in v0.11.7
func SpanLogger ¶ added in v0.11.7
SpanLogger returns a Logger that writes to the give context's span logs.
The logger will use the context's baggage to determine the log level and color profile:
- If no-color=true is set in baggage, the profile will be Ascii. Otherwise, it will be ANSI.
- If debug=true is set in baggage, the log level will be Debug. Otherwise, it will be Info.
func (*Logger) ExtraDebug ¶
func (*Logger) ExtraDebugContext ¶
func (*Logger) TraceContext ¶
Click to show internal directories.
Click to hide internal directories.