log

package module
v0.0.0-...-06ff242 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 5 Imported by: 0

README

log

copy from github.com/tochemey/goakt

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = New(InfoLevel, os.Stdout)

DefaultLogger represents the default Log to use This Log wraps zerolog under the hood

View Source
var DiscardLogger = New(InfoLevel, io.Discard)

Functions

func Error

func Error(v ...interface{})

Error logs to the ERROR level.

func Errorf

func Errorf(format string, v ...interface{})

Errorf logs to the ERROR level.

func Fatal

func Fatal(v ...interface{})

Fatal logs to the FATAL level followed by a call to os.Exit(1).

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf logs to the FATAL level followed by a call to os.Exit(1).

func Info

func Info(v ...interface{})

Info logs to INFO level.

func Infof

func Infof(format string, v ...interface{})

Infof logs to INFO level

func Panic

func Panic(v ...interface{})

Panic logs to the PANIC level followed by a call to panic().

func Panicf

func Panicf(format string, v ...interface{})

Panicf logs to the PANIC level followed by a call to panic().

func Warning

func Warning(v ...interface{})

Warning logs to the WARNING level.

func Warningf

func Warningf(format string, v ...interface{})

Warningf logs to the WARNING level.

Types

type Level

type Level int

Level specifies the log level

const (
	// InfoLevel indicates Info log level.
	InfoLevel Level = iota
	// WarningLevel indicates Warning log level.
	WarningLevel
	// ErrorLevel indicates Error log level.
	ErrorLevel
	// FatalLevel indicates Fatal log level.
	FatalLevel
	// PanicLevel indicates Panic log level
	PanicLevel
	// DebugLevel indicates Debug log level
	DebugLevel
	InvalidLevel
)

func (Level) String

func (l Level) String() string

String returns the string representation of the level

type Log

type Log struct {
	*zap.Logger
}

Log implements Logger interface with the underlying zap as the underlying logging library

func New

func New(level Level, writer io.Writer) *Log

New creates an instance of Log

func (*Log) Debug

func (l *Log) Debug(v ...any)

Debug starts a message with debug level

func (*Log) Debugf

func (l *Log) Debugf(format string, v ...any)

Debugf starts a message with debug level

func (*Log) Error

func (l *Log) Error(v ...any)

Error starts a new message with error level.

func (*Log) Errorf

func (l *Log) Errorf(format string, v ...any)

Errorf starts a new message with error level.

func (*Log) Fatal

func (l *Log) Fatal(v ...any)

Fatal starts a new message with fatal level. The os.Exit(1) function is called which terminates the program immediately.

func (*Log) Fatalf

func (l *Log) Fatalf(format string, v ...any)

Fatalf starts a new message with fatal level. The os.Exit(1) function is called which terminates the program immediately.

func (*Log) Info

func (l *Log) Info(v ...any)

Info starts a message with info level

func (*Log) Infof

func (l *Log) Infof(format string, v ...any)

Infof starts a message with info level

func (*Log) LogLevel

func (l *Log) LogLevel() Level

LogLevel returns the log level that is used

func (*Log) Panic

func (l *Log) Panic(v ...any)

Panic starts a new message with panic level. The panic() function is called which stops the ordinary flow of a goroutine.

func (*Log) Panicf

func (l *Log) Panicf(format string, v ...any)

Panicf starts a new message with panic level. The panic() function is called which stops the ordinary flow of a goroutine.

func (*Log) Warn

func (l *Log) Warn(v ...any)

Warn starts a new message with warn level

func (*Log) Warnf

func (l *Log) Warnf(format string, v ...any)

Warnf starts a new message with warn level

type Logger

type Logger interface {
	// Info starts a new message with info level.
	Info(...any)
	// Infof starts a new message with info level.
	Infof(string, ...any)
	// Warn starts a new message with warn level.
	Warn(...any)
	// Warnf starts a new message with warn level.
	Warnf(string, ...any)
	// Error starts a new message with error level.
	Error(...any)
	// Errorf starts a new message with error level.
	Errorf(string, ...any)
	// Fatal starts a new message with fatal level. The os.Exit(1) function
	// is called which terminates the program immediately.
	Fatal(...any)
	// Fatalf starts a new message with fatal level. The os.Exit(1) function
	// is called which terminates the program immediately.
	Fatalf(string, ...any)
	// Panic starts a new message with panic level. The panic() function
	// is called which stops the ordinary flow of a goroutine.
	Panic(...any)
	// Panicf starts a new message with panic level. The panic() function
	// is called which stops the ordinary flow of a goroutine.
	Panicf(string, ...any)
	// Debug starts a new message with debug level.
	Debug(...any)
	// Debugf starts a new message with debug level.
	Debugf(string, ...any)
	// LogLevel returns the log level being used
	LogLevel() Level
}

Logger represents an active logging object that generates lines of output to an io.Writer.

Jump to

Keyboard shortcuts

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