logging

package
v0.0.0-...-4c9bff6 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Teal ...
	Teal = Color("\033[1;36m%s\033[0m")
	// Yellow ...
	Yellow = Color("\033[35m%s\033[0m")
	// Green
	Green = Color("\033[32m%s\033[0m")
)
View Source
var (
	DefaultLoggerConfig = &Config{
		Debug:  false,
		Level:  InfoLevel,
		writer: os.Stdout,
	}
)

Functions

func Color

func Color(colorString string) func(...interface{}) string

Color ...

func Setup

func Setup(cfg Config) zerolog.Logger

func SetupWithOption

func SetupWithOption(opts ...Option) zerolog.Logger

Types

type Config

type Config struct {
	Env   string `mapstructure:"env"`
	App   string `mapstructure:"app"`
	Debug bool   `mapstructure:"debug"`
	Level Level  `mapstructure:"level"`
	// contains filtered or unexported fields
}

Config for setup log want output setting

type Level

type Level int8

Level defines log levels.

const (
	// DebugLevel defines debug log level.
	DebugLevel Level = iota
	// InfoLevel defines info log level.
	InfoLevel
	// WarnLevel defines warn log level.
	WarnLevel
	// ErrorLevel defines error log level.
	ErrorLevel
	// FatalLevel defines fatal log level.
	FatalLevel
	// PanicLevel defines panic log level.
	PanicLevel
	// NoLevel defines an absent log level.
	NoLevel
	// Disabled disables the logger.
	Disabled

	// TraceLevel defines trace log level.
	TraceLevel Level = -1
)

type Option

type Option interface {
	// contains filtered or unexported methods
}

An Option is passed to Config

func WithApp

func WithApp(app string) Option

func WithDebug

func WithDebug(debug bool) Option

func WithEnv

func WithEnv(env string) Option

func WithLevel

func WithLevel(level Level) Option

func WithOutput

func WithOutput(w io.Writer) Option

Jump to

Keyboard shortcuts

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