logger

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package logger provides structured logging (slog) and context-aware logger retrieval for Genie.

It solves the problem of having a single place to configure log level, output format (JSON or text), and to attach loggers to context so that downstream code can use backend.Logger.FromContext(ctx) without passing a logger explicitly. GetLogger(ctx) returns the request-scoped logger when available, falling back to the default. Without this package, logging would be ad-hoc and inconsistent across components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorAttr

func ErrorAttr(err error) slog.Attr

func GetLogger

func GetLogger(ctx context.Context) *slog.Logger

func IsDebugEnabled

func IsDebugEnabled() bool

func LogLevel

func LogLevel() slog.Level

func SendJSONTo

func SendJSONTo(w io.Writer)

func SetLogHandler

func SetLogHandler(handler slog.Handler)

func SetLogLevel

func SetLogLevel(newLevel slog.Level)

func WithArgs

func WithArgs(ctx context.Context, args ...any) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL