logger

package
v0.0.0-...-0183bb4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package logger provides a simple console logger for reporting information about execution to stderr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level defines valid logging levels for a Logger.

const (
	DebugLevel Level = iota + 1
	InfoLevel
	WarnLevel
	ErrorLevel
)

Valid logging levels

type Logger

type Logger interface {
	Debug(a ...interface{})
	Debugf(format string, a ...interface{})
	Info(a ...interface{})
	Infof(format string, a ...interface{})
	Warn(a ...interface{})
	Warnf(format string, a ...interface{})
	Error(a ...interface{})
	Errorf(format string, a ...interface{})
}

Logger provides basic logging capabilities at different logging levels.

func New

func New(level Level, opts ...Option) Logger

New initializes a new Logger.

type Option

type Option func(opts *options)

Option defines an option for configuring the logger.

func WithField

func WithField(key string, value interface{}) Option

WithField sets the provided key/value pair for use on all logs.

Jump to

Keyboard shortcuts

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