logger

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields added in v0.1.1

type Fields map[string]any

type Logger

type Logger interface {
	SetDebug(bool)
	SetLogFile(string)

	Debug(string, ...any)
	Error(string, ...any)
	Warn(string, ...any)
	Info(string, ...any)
	Fatal(string, ...any)
	Panic(string, ...any)

	Debugf(string, ...any)
	Errorf(string, ...any)
	Warnf(string, ...any)
	Infof(string, ...any)
	Fatalf(string, ...any)
	Panicf(string, ...any)

	WithFields(Fields) Logger
}

Logging structure.

To use,

1) Create a logger:

```go

lgr := logger.NewLogger()

```

2) Do things with it:

```go

lgr.Warn("Not enough coffee!")
lgr.Info("Water is heating up.")
// and so on.

```

If an empty string is passed to `NewLogger`, then the log facility will display messages on standard output.

func NewDefaultLogger

func NewDefaultLogger() Logger

Create a new default logger.

func NewZapLogger added in v0.4.0

func NewZapLogger() Logger

Create a new logger.

func NewZapLoggerWithFile added in v0.4.0

func NewZapLoggerWithFile(logfile string) Logger

Create a new logger with the given log file.

Jump to

Keyboard shortcuts

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