bzerolog

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsoleWriter

func ConsoleWriter(noColor bool, writer ...io.Writer) io.Writer

ConsoleWriter writes to console in Human Readable format

Note:

It's important NOT to exclude time when using this writer

func DefaultZeroLogBuilder

func DefaultZeroLogBuilder(conf LogSettings) log.Builder

func GetLogFolderPath

func GetLogFolderPath(serviceName string) (string, error)

Types

type LogSettings

type LogSettings struct {
	LogToFile           bool
	FileJsonFormat      bool
	LogToConsole        bool
	ConsoleJsonFormat   bool
	CompressLogsFile    bool
	DisableConsoleColor bool
}

type ZerologBuilder

type ZerologBuilder interface {
	log.Builder
	// SetWriter set where output should be printed
	SetWriter(writer io.Writer) ZerologBuilder
	// AddStaticFields will always add provided fields to every log entry
	AddStaticFields(fields map[string]interface{}) ZerologBuilder
	// ExcludeTime configures zerolog to exclude any time field
	ExcludeTime() ZerologBuilder
	// SetCustomTimeFormatter sets the time format field, have no effect if ExcludeTime is called
	SetCustomTimeFormatter(format string) ZerologBuilder
	// IncludeCaller adds caller:line to log entry
	IncludeCaller() ZerologBuilder
	// DisableColor Disable the text console logs color
	DisableColor() ZerologBuilder
}

ZerologBuilder is helper builder to configure zerolog instance

func Builder

func Builder() ZerologBuilder

Builder creates a new zerolog builder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳