Documentation
¶
Overview ¶
Package logging provides structured logging using slog. Logs are written to .co/debug.log in append mode.
Index ¶
- Constants
- func Close() error
- 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 Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func Init(projectRoot string) error
- func Logger() *slog.Logger
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func With(args ...any) *slog.Logger
- func WithGroup(name string) *slog.Logger
Constants ¶
View Source
const ( // LogFileName is the name of the debug log file. LogFileName = "debug.log" // ConfigDir is the directory name for project configuration. ConfigDir = ".co" )
Variables ¶
This section is empty.
Functions ¶
func DebugContext ¶
DebugContext logs at debug level with context.
func ErrorContext ¶
ErrorContext logs at error level with context.
func InfoContext ¶
InfoContext logs at info level with context.
func Init ¶
Init initializes the logger with the project root path. Logs are written to <projectRoot>/.co/debug.log in append mode. If projectRoot is empty, logging is disabled (writes to io.Discard).
func WarnContext ¶
WarnContext logs at warning level with context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.