logger

package
v0.0.0-...-8a90fd1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 9 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 Level

type Level int

Level is a log level.

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

Log levels.

type Logger

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

Logger is a log handler.

func New

func New(level Level, destinations []Destination, filePath string) (*Logger, error)

New allocates a log handler.

func (*Logger) Close

func (lh *Logger) Close()

Close closes a log handler.

func (*Logger) Log

func (lh *Logger) Log(level Level, format string, args ...interface{})

Log writes a log entry.

type Writer

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

Writer is an object that provides a log method.

func NewLimitedLogger

func NewLimitedLogger(w Writer) Writer

NewLimitedLogger is a wrapper around a Writer that limits printed messages.

Jump to

Keyboard shortcuts

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