logger

package
v1.20.1-soundar.7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package logger contains a logger implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination int

Destination is a log destination.

const (
	// DestinationStdout writes logs to the standard output.
	DestinationStdout Destination = iota

	// DestinationFile writes logs to a file.
	DestinationFile

	// DestinationSyslog writes logs to the system logger.
	DestinationSyslog
)

type InlineWriter

type InlineWriter struct {
	Parent Writer
	Prefix string
}

InlineWriter is a Writer that can be created inline.

func (*InlineWriter) Log

func (w *InlineWriter) Log(level Level, msg string, args ...any)

Log implements Writer.

type Level

type Level int

Level is a log level.

const (
	Debug Level = iota + 1
	Info
	Warn
	Error
)

Log levels.

type Logger

type Logger struct {
	Level        Level
	Destinations []Destination
	Structured   bool
	File         string
	SysLogPrefix string
	// contains filtered or unexported fields
}

Logger is a log handler.

func (*Logger) Close

func (l *Logger) Close()

Close closes a log handler.

func (*Logger) Initialize

func (l *Logger) Initialize() error

Initialize initializes Logger.

func (*Logger) Log

func (l *Logger) Log(level Level, format string, args ...any)

Log writes a log entry.

type Writer

type Writer interface {
	Log(Level, string, ...any)
}

Writer is an object that provides a log method.

Jump to

Keyboard shortcuts

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