logger

package module
v0.0.0-...-9ef0c89 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 8 Imported by: 0

README

logger

Pretty simple colorful logger based on slog package.

Screenshot

Install

go get github.com/fl1ckje/logger

Examples

// Messages without JSON data
logger.Info("Starting server.")
logger.Debug("debug msg test")
logger.Info("info msg test")
logger.Warn("warn msg test")
logger.Error("error msg test")

// Messages with JSON data
logger.Debug("debug msg w json test", slog.String("string kv", "string value"))
logger.Info("info msg w json test", slog.Bool("bool kv", true))
logger.Warn("warn msg w json test", slog.Time("time kv", time.Now()))
logger.Error("error msg w json test", slog.Any("any kv", map[string]int{"user": 0, "id": 1, "ext_data": 2}))

Credits

  • Color support via @jwalton: gchalk

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

func Error

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

func Info

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

func Warn

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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