Simple Golang package for common logging requirements
Find a file
2025-09-16 04:48:29 +00:00
.github ci(release): add release name 2025-04-04 11:41:34 +02:00
.gitignore feat: initial commit 2025-03-06 11:26:17 +01:00
.gitlab-ci.yml chore(package): update goreleaser/goreleaser docker tag to v2.12.1 2025-09-16 04:48:29 +00:00
.goreleaser.yaml ci(release): add release name 2025-04-04 11:41:34 +02:00
debug.go feat: rename package to logger 2025-03-06 11:58:51 +01:00
LICENSE feat: initial commit 2025-03-06 11:25:38 +01:00
logging.go feat: rename package to logger 2025-03-06 11:58:51 +01:00
prefix.go feat: rename package to logger 2025-03-06 11:58:51 +01:00
readme.md docs: improved readme 2025-03-06 12:30:04 +01:00
renovate.json feat: initial commit 2025-03-06 11:25:38 +01:00

Logger

This simple Golang package can be used for common logging functionality. Only when debug is on, non fatal errors will be shown.

Install

go get -u github.com/scornet256/go-logger

Basic usage

logger.Print("Simple log message withouth error", nil)
logger.Fatal("Fatal log message with error and exits the program", err)

Will output like this:

2025/12/01 11:17:35 MyApp | LOG: Simple log message withouth error
2025/12/01 11:17:35 MyApp | FATAL: Fatal log message with error
2025/12/01 11:17:35 MyApp | ERROR: <insert value of err> 

Options

logger.SetAppName("todo-app")     # optional; default "MyApp"
logger.SetDebug(true)             # optional; default false

Return functions

logger.GetAppName()  # will return the current used app name as a string.
logger.GetDebug()    # will return the current debug setting as a bool.