log

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a wrapper around zerolog and options

func NewLogger

func NewLogger() *Logger

Creates a new logger with default settings:

dir: "./logs"

name: "app"

wantConsoleOutput: false

wantFileOutput: true

func (*Logger) Debug

func (l *Logger) Debug(msg string)

Prints a debug message to log output if level is debug

May also print to os.Stdout if logger was created with WithConsoleOutput()

func (*Logger) Error

func (l *Logger) Error(msg string)

Prints an error message to log output

May also print to os.Stderr if logger was created with WithConsoleOutput()

func (*Logger) Info

func (l *Logger) Info(msg string)

Prints an info message to log output

May also print to os.Stdout if logger was created with WithConsoleOutput()

func (*Logger) Warn

func (l *Logger) Warn(msg string)

Prints a warning message to log output

May also print to os.Stdout if logger was created with WithConsoleOutput()

func (*Logger) WithConsoleOutput

func (l *Logger) WithConsoleOutput(want bool) *Logger

Modifies logger to also print to console (just fmt no json)

func (*Logger) WithDebug

func (l *Logger) WithDebug(want bool) *Logger

Modifies logger to use debug level

func (*Logger) WithDirectory

func (l *Logger) WithDirectory(dir string) *Logger

Modifies logger to use a custom directory for log file

func (*Logger) WithName

func (l *Logger) WithName(name string) *Logger

Modifies logger to use a custom name for log file and logger

Jump to

Keyboard shortcuts

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