log

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...interface{})

Debug logs a debug message

func Debugf

func Debugf(template string, args ...interface{})

Debugf logs a formatted debug message

func Error

func Error(msg string, args ...interface{})

Error logs an error message

func Errorf

func Errorf(template string, args ...interface{})

Errorf logs a formatted error message

func Fatal

func Fatal(msg string, args ...interface{})

Fatal logs a fatal message and exits

func Fatalf

func Fatalf(template string, args ...interface{})

Fatalf logs a formatted fatal message and exits

func Get

func Get() *zap.SugaredLogger

Get returns the global logger If not initialized, it initializes with default config

func Info

func Info(msg string, args ...interface{})

Info logs an info message

func Infof

func Infof(template string, args ...interface{})

Infof logs a formatted info message

func Init

func Init(cfg Config) error

Init initializes the global logger with the given configuration

func Progress

func Progress(msg string, args ...interface{})

Progress logs a progress message (maps to Info level)

func Progressf

func Progressf(template string, args ...interface{})

Progressf logs a formatted progress message

func Reset

func Reset()

Reset resets the global logger (mainly for testing)

func Sync

func Sync() error

Sync flushes any buffered log entries

func Warn

func Warn(msg string, args ...interface{})

Warn logs a warning message

func Warnf

func Warnf(template string, args ...interface{})

Warnf logs a formatted warning message

func With

func With(args ...interface{}) *zap.SugaredLogger

With returns a logger with additional fields

Types

type Config

type Config struct {
	Level  LogLevel
	Format string // "console" or "json" (future)
}

Config holds logger configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default logger configuration

type LogLevel

type LogLevel string

LogLevel represents the verbosity of logging

const (
	// LevelDebug enables all logs
	LevelDebug LogLevel = "debug"
	// LevelInfo enables info, warning, and error logs
	LevelInfo LogLevel = "info"
	// LevelProgress enables progress, warning, and error logs (default)
	LevelProgress LogLevel = "progress"
	// LevelMinimal enables only warning and error logs
	LevelMinimal LogLevel = "minimal"
	// LevelWarn enables only warning and error logs (alias for minimal)
	LevelWarn LogLevel = "warn"
	// LevelError enables only error logs
	LevelError LogLevel = "error"
)

Jump to

Keyboard shortcuts

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