logger

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package logger provides a logging implementation based on uber-go/zap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *Config) slog.Logger

New creates a darvaza.org/slog.Logger using the given go.uber.org/zap.Config. If cfg is nil, a default console logger will be created with development-friendly settings.

func NewWithThreshold

func NewWithThreshold(cfg *Config, threshold slog.LogLevel) slog.Logger

NewWithThreshold works like New but restricts output to messages at or above the specified level threshold.

Example thresholds:

slog.LevelDebug   // Show all messages
slog.LevelInfo    // Show info and above
slog.LevelWarning // Show only warnings and errors

Types

type Config

type Config = zap.Config

Config is an alias of [zap.Config]

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns the console config for developers New will use when no config is provided.

Jump to

Keyboard shortcuts

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