logger

package
v0.0.0-...-b11d9e2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProductionEnvironment  = "production"
	StagingEnvironment     = "development"
	DevelopmentEnvironment = "staging"
)

Variables

This section is empty.

Functions

func ConfigProductionEncoder

func ConfigProductionEncoder() zapcore.EncoderConfig

NewProductionEncoder returns an opinionated EncoderConfig for production environments.

func ConfigProductionLogger

func ConfigProductionLogger() zap.Config

*

** NewProductionConfig is a reasonable production logging configuration.
** Logging is enabled at InfoLevel and above.
**	It uses a CONSOLE encoder, writes to standard error, and enables sampling.
** Stacktraces are automatically included on logs of ErrorLevel and above.

*

func Debug

func Debug(args ...interface{})

Debug uses fmt.Sprint to construct and log a message

func Debugf

func Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated message

func Debugw

func Debugw(msg string, keysValues ...interface{})

Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With

func Error

func Error(args ...interface{})

Error uses fmt.Sprint to construct and log a message

func Errorf

func Errorf(template string, args ...interface{})

Errorf uses fmt.Sprintf to log a templated message

func Errorw

func Errorw(msg string, keysValues ...interface{})

Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func Fatal

func Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit

func Fatalf

func Fatalf(template string, args ...interface{})

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit

func Fatalw

func Fatalw(msg string, keysValues ...interface{})

Fatalw logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With

func Info

func Info(args ...interface{})

Info uses fmt.Sprint to construct and log a message

func Infof

func Infof(template string, args ...interface{})

Infof uses fmt.Sprintf to log a templated message

func Infow

func Infow(msg string, keysValues ...interface{})

Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func New

func New(environment string)

Default production is false if not call func

func Panic

func Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics

func Panicf

func Panicf(template string, args ...interface{})

Panicf uses fmt.Sprintf to log a templated message, then panics

func Panicw

func Panicw(msg string, keysValues ...interface{})

Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With

func Warn

func Warn(args ...interface{})

Warn uses fmt.Sprint to construct and log a message

func Warnf

func Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message

func Warnw

func Warnw(msg string, keysValues ...interface{})

Warnw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func WithLogger

func WithLogger(_logger Logger)

WithLogger set global logger by new logger

Types

type Logger

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

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

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

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

	Panic(args ...interface{})
	Panicf(template string, args ...interface{})
	Panicw(msg string, keysValues ...interface{})

	Fatal(args ...interface{})
	Fatalf(template string, args ...interface{})
	Fatalw(msg string, keysValues ...interface{})
}

Jump to

Keyboard shortcuts

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