8000 GitHub - x1rh/logger
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

x1rh/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logger

logger is a simple and sufficiently practical logger package, using log/slog, aiming to avoid dependency on third-party libraries.

usage

import (
    "log/slog"
    _ "github.com/x1rh/logger"
)

func main() {
    // initialize it by importing it
    slog.Info("hello")
    slog.Info("message 1", slog.String("key", "value"))
    slog.Error("error")

    // or Configure() it again 
    logLevel := slog.LevelDebug
    addSource := true
    logger.Configure(logLevel, addSource)
}

Initialize the default slog logger once in the function main() and use it anywhere.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0