logging

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logging provides structured logging for the chotko application. It uses Go's log/slog package for structured, leveled logging.

Index

Constants

This section is empty.

Variables

View Source
var Logger *slog.Logger

Logger is the global application logger.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs a debug message.

func Error

func Error(msg string, args ...any)

Error logs an error message.

func Info

func Info(msg string, args ...any)

Info logs an info message.

func Init

func Init(cfg Config) error

Init initializes the global logger with the given configuration.

func Warn

func Warn(msg string, args ...any)

Warn logs a warning message.

func With

func With(args ...any) *slog.Logger

With returns a logger with additional context.

Types

type Config

type Config struct {
	Level   slog.Level
	Output  io.Writer
	JSON    bool
	LogFile string
}

Config holds logging configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default logging configuration. Logs to stderr at Info level in text format.

Jump to

Keyboard shortcuts

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