logging

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Critical

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

Critical writes a critical log using the default logger.

func Debug

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

Debug writes a debug log using the default logger.

func DebugStart added in v0.12.5

func DebugStart(logger *Logger, operation string, format string, args ...interface{}) func(error)

DebugStart logs a standardized debug start line and returns a function that logs the end status (ok/error) with duration.

func DebugStartBootstrap added in v0.12.5

func DebugStartBootstrap(logger *BootstrapLogger, operation string, format string, args ...interface{}) func(error)

DebugStartBootstrap logs a standardized debug start line and returns a function that logs the end status (ok/error) with duration.

func DebugStep added in v0.12.5

func DebugStep(logger *Logger, operation string, format string, args ...interface{})

DebugStep logs a standardized debug progress line for an operation.

func DebugStepBootstrap added in v0.12.5

func DebugStepBootstrap(logger *BootstrapLogger, operation string, format string, args ...interface{})

DebugStepBootstrap logs a standardized debug progress line for an operation.

func Error

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

Error writes an error log using the default logger.

func Fatal

func Fatal(exitCode types.ExitCode, format string, args ...interface{})

Fatal writes a critical log and exits with the specified code

func Info

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

Info writes an informational log using the default logger

func SetDefaultLogger

func SetDefaultLogger(logger *Logger)

SetDefaultLogger sets the default logger.

func Skip

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

Skip writes a SKIP log using the default logger.

func Step

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

Step writes a STEP log using the default logger.

func Warning

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

Warning writes a warning log using the default logger.

Types

type BootstrapLogger

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

BootstrapLogger accumulates logs generated before the main logger is initialized, so they can be flushed into the final log.

func NewBootstrapLogger

func NewBootstrapLogger() *BootstrapLogger

NewBootstrapLogger creates a new bootstrap logger with INFO level by default.

func (*BootstrapLogger) Debug

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

Debug records a debug message without printing it to the console.

func (*BootstrapLogger) Error

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

Error records an early error message (stderr).

func (*BootstrapLogger) Flush

func (b *BootstrapLogger) Flush(logger *Logger)

Flush flushes accumulated entries into the main logger (only the first time).

func (*BootstrapLogger) Info

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

Info logs an early informational message.

func (*BootstrapLogger) Printf

func (b *BootstrapLogger) Printf(format string, args ...interface{})

Printf records a formatted line as raw.

func (*BootstrapLogger) Println

func (b *BootstrapLogger) Println(message string)

Println records a raw line (used for banners/text without a header).

func (*BootstrapLogger) SetLevel

func (b *BootstrapLogger) SetLevel(level types.LogLevel)

SetLevel updates the minimum level used during Flush.

func (*BootstrapLogger) SetMirrorLogger

func (b *BootstrapLogger) SetMirrorLogger(logger *Logger)

SetMirrorLogger forwards every bootstrap message to the provided logger.

func (*BootstrapLogger) Warning

func (b *BootstrapLogger) Warning(format string, args ...interface{})

Warning records an early warning message (printed to stderr).

type Logger

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

Logger handles application logging.

func GetDefaultLogger

func GetDefaultLogger() *Logger

GetDefaultLogger returns the default logger.

func New

func New(level types.LogLevel, useColor bool) *Logger

New creates a new logger.

func StartSessionLogger

func StartSessionLogger(flow string, level types.LogLevel, useColor bool) (*Logger, string, func(), error)

StartSessionLogger creates a new logger instance that writes to a real-time log file under /tmp/proxsave. The caller receives the configured logger, the absolute log path, and a cleanup function that must be invoked when the session completes.

func (*Logger) AppendRaw added in v0.11.3

func (l *Logger) AppendRaw(message string)

AppendRaw writes a raw log line directly to the log file (if any) without emitting it to stdout. It is primarily used by the bootstrap logger to persist early banner/output without duplicating it on console.

func (*Logger) CloseLogFile

func (l *Logger) CloseLogFile() error

CloseLogFile closes the log file (call after notifications).

func (*Logger) Critical

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

Critical writes a critical log.

func (*Logger) Debug

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

Debug writes a debug log.

func (*Logger) Error

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

Error writes an error log.

func (*Logger) ErrorCount added in v0.13.4

func (l *Logger) ErrorCount() int64

ErrorCount returns the total number of ERROR/CRITICAL log entries emitted.

func (*Logger) Fatal

func (l *Logger) Fatal(exitCode types.ExitCode, format string, args ...interface{})

Fatal writes a critical log and exits with the specified code

func (*Logger) GetLevel

func (l *Logger) GetLevel() types.LogLevel

GetLevel returns the current log level.

func (*Logger) GetLogFilePath

func (l *Logger) GetLogFilePath() string

GetLogFilePath returns the path of the currently open log file (or "" if none).

func (*Logger) HasErrors

func (l *Logger) HasErrors() bool

HasErrors returns true if at least one error or critical message was logged.

func (*Logger) HasWarnings

func (l *Logger) HasWarnings() bool

HasWarnings returns true if at least one warning was logged.

func (*Logger) Info

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

Info writes an informational log

func (*Logger) IssueLines added in v0.13.4

func (l *Logger) IssueLines() []string

IssueLines returns a copy of captured WARNING/ERROR/CRITICAL log lines in chronological order. Intended for end-of-run summaries.

func (*Logger) OpenLogFile

func (l *Logger) OpenLogFile(logPath string) error

OpenLogFile opens a log file and starts real-time writing.

func (*Logger) Phase

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

Phase writes an informational log with PHASE label

func (*Logger) SetExitFunc

func (l *Logger) SetExitFunc(fn func(int))

SetExitFunc allows customizing the exit function (useful for tests). If fn is nil, it restores os.Exit.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level types.LogLevel)

SetLevel sets the logging level.

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

SetOutput sets the logger output writer.

func (*Logger) Skip

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

Skip writes an informational log with SKIP label (for disabled/ignored elements)

func (*Logger) Step

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

Step writes an informational log with STEP label (to highlight sequential activities)

func (*Logger) UsesColor

func (l *Logger) UsesColor() bool

UsesColor returns whether color output is enabled.

func (*Logger) Warning

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

Warning writes a warning log.

func (*Logger) WarningCount added in v0.13.4

func (l *Logger) WarningCount() int64

WarningCount returns the total number of WARNING log entries emitted.

Jump to

Keyboard shortcuts

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