log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package log provides structures for logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleLogger

type ConsoleLogger struct {
	*log.Logger
}

ConsoleLogger implements Logger interface. It represents logger that outputs to os.Stdout and os.Stderr.

func NewConsoleLogger

func NewConsoleLogger() *ConsoleLogger

NewConsoleLogger creates *log.Logger and embeds it into ConsoleLogger. It returns pointer to a ConsoleLogger instance.

func (*ConsoleLogger) Debug

func (logger *ConsoleLogger) Debug(format string, v ...any)

Debug outputs variables in specified format with DEBUG prefix.

func (*ConsoleLogger) Error

func (logger *ConsoleLogger) Error(format string, v ...any)

Error outputs variables in specified format with ERROR prefix.

func (*ConsoleLogger) Fatal

func (logger *ConsoleLogger) Fatal(format string, v ...any)

Fatal outputs variables in specified format with FATAL prefix. It also calls os.Exit(1).

func (*ConsoleLogger) Info

func (logger *ConsoleLogger) Info(format string, v ...any)

Info outputs variables in specified format with INFO prefix.

type Logger

type Logger interface {
	// Debug outputs variables in specified format with DEBUG prefix.
	Debug(format string, v ...any)

	// Info outputs variables in specified format with INFO prefix.
	Info(format string, v ...any)

	// Error outputs variables in specified format with ERROR prefix.
	Error(format string, v ...any)

	// Fatal outputs variables in specified format with FATAL prefix.
	// It also calls os.Exit(1).
	Fatal(format string, v ...any)
}

Logger is interface implemented by types that can log at various levels.

Jump to

Keyboard shortcuts

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