logger

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 2 Imported by: 5

README

HAProxy

Go Logger

Contributors License

Description

Go Logger is an interface for logging in Go programing language. Beside interface it also provides option to create a logger that can log to multiple destinations

Using multiple loggers at the same time
import (
  ...
  logger "github.com/haproxytech/go-logger"
  ...
)

log1 := // create log1
log2 := // create log2

log := logger.New(log1, log2)

log.Print("Printing to two different loggers")
Contributing

Thanks for your interest in the project and your willing to contribute:

Discussion

A Github issue is the right place to discuss feature requests, bug reports or any other subject that needs tracking.

To ask questions, get some help or even have a little chat, you can join our #ingress-controller channel in HAProxy Community Slack.

License

Apache License 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format interface {
	Printf(format string, args ...interface{})
	Tracef(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})
}

type LogLevel added in v1.1.0

type LogLevel uint8
const (
	LevelTrace   LogLevel = 1
	LevelDebug   LogLevel = 2
	LevelPrint   LogLevel = 3
	LevelInfo    LogLevel = 4
	LevelWarning LogLevel = 5
	LevelError   LogLevel = 6
	LevelFatal   LogLevel = 7
	LevelPanic   LogLevel = 8
)

type Logger

type Logger interface {
	Std
	Format
}

func Convert added in v1.1.0

func Convert(log Logger, logLevel LogLevel) Logger

Convert converts all `higher` level messages to a loglevel ones.

func Limit added in v1.1.0

func Limit(log Logger, logLevel LogLevel) Logger

limits printing only above threashold.

func New

func New(logger ...Logger) Logger

type Std

type Std interface {
	Print(args ...interface{})
	Trace(args ...interface{})
	Debug(args ...interface{})
	Info(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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