Help us shape the future of Go! Take the 2026 Go Developer Survey

logger

package
v0.7.7 Latest Latest
Warning

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

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

Documentation

Overview

Package logger provides structured logging for the Prism daemon with proper log levels.

Log levels and their destinations:

  • DEBUG: Detailed diagnostic information → stdout
  • INFO: Normal operation messages → stdout
  • WARN: Warning conditions → stderr
  • ERROR: Error conditions → stderr

Usage:

logger.Info("Server starting", "port", 8947)
logger.Debug("Processing request", "method", "GET", "path", "/api/v1/instances")
logger.Warn("Rate limit approaching", "current", 95, "max", 100)
logger.Error("Failed to connect", "error", err)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs a debug message to stdout

func Error

func Error(msg string, args ...any)

Error logs an error message to stderr

func Fatal

func Fatal(msg string, args ...any)

Fatal logs an error message and exits with status 1

func Info

func Info(msg string, args ...any)

Info logs an informational message to stdout

func Initialize

func Initialize(level LogLevel)

Initialize sets up the logging infrastructure This should be called once at daemon startup

func Reset

func Reset()

Reset resets the logger state (primarily for testing)

func SetOutput

func SetOutput(stdout, stderr io.Writer)

SetOutput redirects logger output (primarily for testing) Preserves the current log level settings

func Warn

func Warn(msg string, args ...any)

Warn logs a warning message to stderr

Types

type LogLevel

type LogLevel string

LogLevel represents the logging level

const (
	LevelDebug LogLevel = "debug"
	LevelInfo  LogLevel = "info"
	LevelWarn  LogLevel = "warn"
	LevelError LogLevel = "error"
)

func GetLevel

func GetLevel() LogLevel

GetLevel returns the current log level from environment or default

Jump to

Keyboard shortcuts

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