swarmlog

package
v1.13.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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.

func SetLevel

func SetLevel(level zapcore.Level)

SetLevel allows changing the log level at runtime.

func Sync

func Sync()

Sync flushes any buffered log entries.

Types

type SwarmLogger

type SwarmLogger struct {
	*zap.SugaredLogger
}

SwarmLogger wraps zap’s SugaredLogger for convenience.

func L

func L() *SwarmLogger

L returns the global logger or a no-op fallback if uninitialized.

func (*SwarmLogger) With

func (l *SwarmLogger) With(args ...interface{}) *SwarmLogger

With adds structured fields to the logger and returns a new instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL