logx

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logx wraps structured logging setup and logger configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Level is the minimum log level (debug, info, warn, error, fatal).
	Level string
	// Format is the log output format: "json" (default/production) or "text" (dev console).
	Format string
}

Config holds logger configuration. Populated from the application config.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger wraps zerolog.Logger to provide a minimal structured logging abstraction for core runtime paths. Modules and middleware receive a *Logger via dependency injection — no global singleton.

func New

func New(cfg Config) (*Logger, error)

New creates a production-ready Logger from the given Config. It returns an error if the config contains an invalid log level.

func NewWithWriter

func NewWithWriter(cfg Config, out io.Writer) (*Logger, error)

NewWithWriter creates a logger writing to the provided writer.

func (*Logger) Debug

func (l *Logger) Debug() *zerolog.Event

Debug starts a debug-level log event.

func (*Logger) Error

func (l *Logger) Error() *zerolog.Event

Error starts an error-level log event.

func (*Logger) Fatal

func (l *Logger) Fatal() *zerolog.Event

Fatal starts a fatal-level log event. After the event is logged, os.Exit(1) is called.

func (*Logger) Info

func (l *Logger) Info() *zerolog.Event

Info starts an info-level log event.

func (*Logger) Warn

func (l *Logger) Warn() *zerolog.Event

Warn starts a warn-level log event.

Jump to

Keyboard shortcuts

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