Logging

A zap logger in one line, with the level taken from configuration.

Import
github.com/HiWay-Media/hwm-go-utils/log
Returns
*zap.SugaredLogger, the type every other package accepts

Usage

logger := log.GetLogger(os.Getenv("LOG_LEVEL"))

logger.Infow("channel started", "channel", 42, "region", "eu")
logger.Errorf("upstream failed: %v", err)

Output (stderr, console format, plain-text levels — no ANSI colour codes, so it reads well in Loki, CloudWatch or docker logs):

2026-09-24T10:17:21.770+0200	INFO	player/main.go:31	channel started	{"channel": 42, "region": "eu"}
2026-09-24T10:17:22.104+0200	ERROR	player/main.go:40	upstream failed: context deadline exceeded

Levels

logLevel (case-insensitive) Level
debug Debug
info, empty or unknown Info
warn Warn
error Error
fatal Fatal
panic Panic

Pass the same logger to generic.SetEndpoints, nomad.Options, nats_helper and the HTTP client, so every package writes to one place with one level.