avyos.dev/pkg/logger

package logger

Overview

No package-level documentation is provided.

Export GroupCount
Constants0
Variables1
Functions5
Types2

Variables

Default

var Default = New("")

Default is the default logger instance

Functions

Debug

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

Debug logs a debug message using the default logger

Error

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

Error logs an error message using the default logger

Info

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

Info logs an info message using the default logger

SetupSystemLog

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

Warn

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

DEBUG, INFO, WARN, ERROR

const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
)

Methods

String

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

New

func New(component string) *Logger

New creates a new logger for the given component

Methods

Debug

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

Debug logs a debug message

Error

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

Error logs an error message

Info

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

Info logs an info message

SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel sets the minimum log level

Warn

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

Warn logs a warning message

With

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

With returns a new logger with the given field attached