Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(appName string)
Init initializes the global logger.
It automatically determines the environment using SWARMCLI_ENV:
- SWARMCLI_ENV=dev → human-readable logs in ~/.local/state/<app>/app-debug.log
- SWARMCLI_ENV=prod → JSON logs in ~/.local/state/<app>/app.log
The log level is controlled via LOG_LEVEL (debug, info, warn, error, etc). If unset, defaults to debug in dev mode and info in prod mode.
func InitTestIfTestLogEnv ¶
func InitTestIfTestLogEnv()
InitTestIfTestLogEnv creates a lightweight logger for tests that logs to stdout if the `TEST_LOG` env is set.
Types ¶
type SwarmLogger ¶
type SwarmLogger struct {
*zap.SugaredLogger
}
SwarmLogger wraps zap’s SugaredLogger for convenience.
func (*SwarmLogger) With ¶
func (l *SwarmLogger) With(args ...interface{}) *SwarmLogger
With adds structured fields to the logger and returns a new instance.
Click to show internal directories.
Click to hide internal directories.