logging

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

internal/logging/logger.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldLogger

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

FieldLogger is a logger that includes additional fields in logs

func (*FieldLogger) Debug

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

Debug logs a debug message with fields

func (*FieldLogger) Error

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

Error logs an error message with fields

func (*FieldLogger) Fatal

func (fl *FieldLogger) Fatal(format string, args ...interface{})

Fatal logs a fatal message with fields and exits the program

func (*FieldLogger) Info

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

Info logs an informational message with fields

func (*FieldLogger) Warning

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

Warning logs a warning message with fields

type LogLevel

type LogLevel int

LogLevel represents the severity of a log message

const (
	// DEBUG level for verbose debugging information
	DEBUG LogLevel = iota
	// INFO level for general information
	INFO
	// WARNING level for non-critical problems
	WARNING
	// ERROR level for error conditions
	ERROR
	// FATAL level for unrecoverable errors
	FATAL
)

func (LogLevel) String

func (l LogLevel) String() string

String returns the string representation of a log level

type Logger

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

Logger provides structured logging functionality

func NewLogger

func NewLogger(level string) *Logger

NewLogger creates a new logger with the specified log level

func (*Logger) Debug

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

Debug logs a debug message

func (*Logger) Error

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

Error logs an error message

func (*Logger) Fatal

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

Fatal logs a fatal message and exits the program

func (*Logger) GetLogr

func (l *Logger) GetLogr() logr.Logger

GetLogr returns a logr.Logger compatible interface for controller-runtime

func (*Logger) Info

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

Info logs an informational message

func (*Logger) SetJSONFormat

func (l *Logger) SetJSONFormat(useJSON bool)

SetJSONFormat sets whether to use JSON format for logging

func (*Logger) SetOutput

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

SetOutput sets the output writer for the logger

func (*Logger) Warning

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

Warning logs a warning message

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[string]interface{}) *FieldLogger

WithFields creates a new logger with the specified fields

Jump to

Keyboard shortcuts

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