Simple Golang package for common logging requirements
Find a file
2026-06-05 08:31:32 +02:00
.github chore(package): update goreleaser/goreleaser-action action to v7 2026-06-05 08:31:32 +02:00
.woodpecker ci: add gitleaks woodpecker pipeline 2026-05-15 19:24:26 +02:00
.editorconfig chore: add .editorconfig and .gitattributes 2026-05-27 14:24:22 +02:00
.gitattributes chore: add .editorconfig and .gitattributes 2026-05-27 14:24:22 +02:00
.gitignore feat: initial commit 2025-03-06 11:26:17 +01: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 chore: migrate repository to forgejo 2026-05-15 18:11:24 +02: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 git.simoncor.net/golang/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.