nanolog

package module
v0.0.0-...-28a852c Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package nanolog implements a lightweight logger, featuring: - severity given by API, ie Infof(), Debugf() and related - automatic detection of interactive (terminal) or uninteractive (daemon) use - appropriate colour prefix for interactive output - appropriate syslog prefix for non-interactive output

Index

Constants

View Source
const (
	LevelError = 4
	LevelWarn  = 5
	LevelInfo  = 6
	LevelDebug = 7
)

Variables

View Source
var (
	Default, _ = New("", 0)
)

Functions

func Debug

func Debug(format string, args ...any)

func Error

func Error(format string, args ...any)

func Fatal

func Fatal(format string, args ...any)

func Filter

func Filter(filter int)

func Info

func Info(format string, args ...any)

func NamedFilter

func NamedFilter(filter string) error

func Warn

func Warn(format string, args ...any)

Types

type Logger

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

func New

func New(userPrefix string, filter int) (*Logger, error)

filter 0 means use resasonable defaults

func (*Logger) Debug

func (ml *Logger) Debug(format string, args ...any)

func (*Logger) Error

func (ml *Logger) Error(format string, args ...any)

func (*Logger) Fatal

func (ml *Logger) Fatal(format string, args ...any)

func (*Logger) Filter

func (ml *Logger) Filter(filter int)

func (*Logger) Info

func (ml *Logger) Info(format string, args ...any)

func (*Logger) NamedFilter

func (ml *Logger) NamedFilter(filter string) error

func (*Logger) Warn

func (ml *Logger) Warn(format string, args ...any)

Jump to

Keyboard shortcuts

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