Documentation
¶
Overview ¶
Package log provides a colored, human-readable slog.Handler tuned for liteorm's statement logs: one line per executed statement with timing, the SQL, its bind arguments, the rows affected, and the Go source location that issued it — so you can watch every query during development and trace it back to the line of code. Wire it in with liteorm.WithLogger(log.New(os.Stderr, nil)). It also renders ordinary (non-statement) slog records as a plain line, so it can serve as a development logger for the whole program.
For structured/production logging use a standard slog handler instead (slog.NewJSONHandler / slog.NewTextHandler) — liteorm logs the same statement events through whichever handler is configured.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Level slog.Level // minimum level (default slog.LevelDebug — statement logs are emitted at debug)
Color bool // ANSI color (default true; forced off when the NO_COLOR env var is set)
SlowThreshold time.Duration // statements at or over this are highlighted (default 200ms; 0 disables)
AbsPath bool // print the absolute caller path; by default it is shown relative to the working directory
}
Options configures the handler. A nil *Options uses the defaults.