logging

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package logging provides slog helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*slog.Logger
	// contains filtered or unexported fields
}

Logger represents a new slog logger.

func DefaultLogger

func DefaultLogger(opts ...Option) *Logger

DefaultLogger returns a logger with slog default handler.

func DiscardLogger added in v0.1.1

func DiscardLogger() *Logger

DiscardLogger returns a logger with slog.DiscardHandler.

func JSONLogger

func JSONLogger(opts ...Option) *Logger

JSONLogger returns a logger with a slog.JSONHandler.

func StandardLogger added in v0.2.3

func StandardLogger() *Logger

StandardLogger returns a logger with standard options set.

func TextLogger

func TextLogger(opts ...Option) *Logger

TextLogger returns a logger with a slog.TextHandler.

type Option

type Option func(*Logger)

Option function.

func Level

func Level(level slog.Leveler) Option

Level sets the level option.

func Output

func Output(w io.Writer) Option

Output sets the output option.

func SetDefault added in v0.2.2

func SetDefault() Option

SetDefault sets slog logger to Logger.

func TimeFormat

func TimeFormat(t string) Option

TimeFormat set the timeFormat Option. has no impact on DefaultLogger.

func TruncateSource

func TruncateSource() Option

TruncateSource sets the includeSource and trucateSource options.

func WithSource

func WithSource() Option

WithSource sets the includeSource option.

Jump to

Keyboard shortcuts

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