logging

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureWebKitLog

func CaptureWebKitLog(message string)

func Debug

func Debug(message string)

func Error

func Error(message string)

func Fatal

func Fatal(message string)

func Info

func Info(message string)

func Init

func Init(logDir string, level string, format string, enableFileLog bool, maxSize, maxBackups, maxAge int, compress bool) error

func LogCrashInfo added in v0.7.0

func LogCrashInfo(context string)

LogCrashInfo logs information that might be helpful for crash analysis

func SetupCrashHandler added in v0.7.0

func SetupCrashHandler()

SetupCrashHandler sets up signal handlers to catch crashes and log them

func SetupPanicRecovery added in v0.7.0

func SetupPanicRecovery()

SetupPanicRecovery sets up a global panic recovery handler This should be called with defer at the start of main functions

func Warn

func Warn(message string)

Types

type JSONFormatter

type JSONFormatter struct{}

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(level LogLevel, message string, source string) string

type LogFormatter

type LogFormatter interface {
	Format(level LogLevel, message string, source string) string
}

func NewFormatter

func NewFormatter(format string) LogFormatter

type LogLevel

type LogLevel int
const (
	DEBUG LogLevel = iota
	INFO
	WARN
	ERROR
	FATAL
)

func LogLevelInfo

func LogLevelInfo() LogLevel

LogLevelInfo returns the INFO log level constant for external packages

type LogRotator

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

func NewLogRotator

func NewLogRotator(baseDir string, maxSizeMB, maxBackups, maxAgeDays int, compress bool) (*LogRotator, error)

func (*LogRotator) Close

func (r *LogRotator) Close() error

func (*LogRotator) Write

func (r *LogRotator) Write(p []byte) (n int, err error)

type Logger

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

func GetLogger

func GetLogger() *Logger

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

Implement io.Writer interface for standard log package redirection

func (*Logger) WriteFileOnly

func (l *Logger) WriteFileOnly(level LogLevel, message string, source string)

WriteFileOnly writes a log entry only to the file (not stdout) to avoid interfering with CLI operations

func (*Logger) WriteTagged

func (l *Logger) WriteTagged(source string, message string)

type OutputCapture

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

func NewOutputCapture

func NewOutputCapture(logger *Logger) *OutputCapture

func (*OutputCapture) Start

func (c *OutputCapture) Start() error

func (*OutputCapture) Stop

func (c *OutputCapture) Stop()

type TextFormatter

type TextFormatter struct{}

func (*TextFormatter) Format

func (f *TextFormatter) Format(level LogLevel, message string, source string) string

Jump to

Keyboard shortcuts

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