logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

Debug logs a debug message with the given attributes

func Error

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

Error logs an error message with the given attributes

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the configured logger

func Info

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

Info logs an info message with the given attributes

func Init

func Init(level LogLevel)

Init initializes the logger with the specified level

func SetLevel

func SetLevel(level LogLevel)

SetLevel changes the current logging level

func Warn

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

Warn logs a warning message with the given attributes

func WithWriter

func WithWriter(w io.Writer) *slog.Logger

WithWriter returns a logger that writes to the specified writer

Types

type LogLevel

type LogLevel string

LogLevel represents the logging level

const (
	// LogLevelDebug enables debug level logging
	LogLevelDebug LogLevel = "debug"
	// LogLevelInfo enables info level logging
	LogLevelInfo LogLevel = "info"
	// LogLevelWarn enables warn level logging
	LogLevelWarn LogLevel = "warn"
	// LogLevelError enables error level logging
	LogLevelError LogLevel = "error"
)

func GetLogLevel

func GetLogLevel() LogLevel

GetLogLevel returns the current log level

Jump to

Keyboard shortcuts

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