avyos.dev/pkg/logger

package logger

Package Overview

No package-level documentation is provided.

Export GroupCount
Constants0
Variables1
Functions5
Types2

Variables

var Default = New("")

Default is the default logger instance

Functions

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

Debug logs a debug message using the default logger

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

Error logs an error message using the default logger

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

Info logs an info message using the default logger

func SetupSystemLog() error

SetupSystemLog configures process logging to append to a per-process log file while preserving stdout/stderr output.

Root/system process path:

fs.Resolve("cache", "log/services/<name>.log")

User process path:

$HOME/.cache/log/services/<name>.log

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

Warn logs a warning message using the default logger

Types

Level

type Level int

Level represents the log severity level

Constants

const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
)

Methods

func (l Level) String() string

String returns the string representation of the log level

Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger provides structured logging with levels and components

Functions

func New(component string) *Logger

New creates a new logger for the given component

Methods

func (l *Logger) Debug(format string, args ...interface{})

Debug logs a debug message

func (l *Logger) Error(format string, args ...interface{})

Error logs an error message

func (l *Logger) Info(format string, args ...interface{})

Info logs an info message

func (l *Logger) SetLevel(level Level)

SetLevel sets the minimum log level

func (l *Logger) Warn(format string, args ...interface{})

Warn logs a warning message

func (l *Logger) With(key string, value interface{}) *Logger

With returns a new logger with the given field attached