logging

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package logging provides logging interfaces and utilities for LedgerQ.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogger

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

DefaultLogger is a simple logger that writes to stdout/stderr.

func NewDefaultLogger

func NewDefaultLogger(minLevel Level) *DefaultLogger

NewDefaultLogger creates a new default logger with the specified minimum level.

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug(msg string, fields ...Field)

Debug implements Logger.

func (*DefaultLogger) Error

func (l *DefaultLogger) Error(msg string, fields ...Field)

Error implements Logger.

func (*DefaultLogger) Info

func (l *DefaultLogger) Info(msg string, fields ...Field)

Info implements Logger.

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn(msg string, fields ...Field)

Warn implements Logger.

type Field

type Field struct {
	Key   string
	Value interface{}
}

Field represents a structured logging field.

func F

func F(key string, value interface{}) Field

F is a convenience function to create a Field.

type Level

type Level int

Level represents the severity of a log message.

const (
	// LevelDebug for detailed debugging information
	LevelDebug Level = iota
	// LevelInfo for informational messages
	LevelInfo
	// LevelWarn for warning messages
	LevelWarn
	// LevelError for error messages
	LevelError
)

func (Level) String

func (l Level) String() string

String returns the string representation of the log level.

type Logger

type Logger interface {
	// Debug logs a debug message
	Debug(msg string, fields ...Field)

	// Info logs an informational message
	Info(msg string, fields ...Field)

	// Warn logs a warning message
	Warn(msg string, fields ...Field)

	// Error logs an error message
	Error(msg string, fields ...Field)
}

Logger is the interface for logging in LedgerQ. Users can implement this interface to integrate with their logging system.

type NoopLogger

type NoopLogger struct{}

NoopLogger is a logger that does nothing.

func (NoopLogger) Debug

func (NoopLogger) Debug(string, ...Field)

Debug implements Logger.

func (NoopLogger) Error

func (NoopLogger) Error(string, ...Field)

Error implements Logger.

func (NoopLogger) Info

func (NoopLogger) Info(string, ...Field)

Info implements Logger.

func (NoopLogger) Warn

func (NoopLogger) Warn(string, ...Field)

Warn implements Logger.

Jump to

Keyboard shortcuts

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