logger

package
v0.0.0-...-f011ba4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logger copy from github.com/robfig/cron/v3@v3.0.1/logger.go

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = PrintfLogger(log.New(os.Stdout, "fastProxy: ", log.LstdFlags), os.Stdout)

DefaultLogger is used by Cron if none is specified.

View Source
var DiscardLogger = PrintfLogger(log.New(io.Discard, "", 0), io.Discard)

DiscardLogger can be used by callers to discard all log messages.

View Source
var VerboseLogger = VerbosePrintfLogger(log.New(os.Stdout, "fastProxy: ", log.LstdFlags), os.Stdout)

Functions

This section is empty.

Types

type Level

type Level int
const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
)

type Logger

type Logger interface {
	Debug(msg string, keysAndValues ...interface{})
	Debugf(template string, args ...interface{})

	Info(msg string, keysAndValues ...interface{})
	Infof(template string, args ...interface{})

	Warn(msg string, keysAndValues ...interface{})
	Warnf(template string, args ...interface{})

	Error(msg string, keysAndValues ...interface{})
	Errorf(template string, args ...interface{})

	GetWriter() io.Writer

	Flush()
}

Logger is the interface used in this package for logging, so that any backend can be plugged in. It is a subset of the github.com/go-logr/logr interface.

func PrintfLogger

func PrintfLogger(l interface{ Printf(string, ...interface{}) }, w io.Writer) Logger

PrintfLogger wraps a Printf-based logger (such as the standard library "log") into an implementation of the Logger interface which logs errors only.

func VerbosePrintfLogger

func VerbosePrintfLogger(l interface{ Printf(string, ...interface{}) }, w io.Writer) Logger

VerbosePrintfLogger wraps a Printf-based logger (such as the standard library "log") into an implementation of the Logger interface which logs everything.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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