log

package
v0.0.0-...-f2b64ca Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Mode       LoggerType
	OutputFile string
}

Config is used to config a logger

type Logger

type Logger interface {
	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Errorf(template string, args ...interface{})

	// Fatal must execute os.Exit(1) after logging
	Fatalf(template string, args ...interface{})

	// Panic must execute panic() after logging
	Panicf(template string, args ...interface{})
}

Logger is used here to de-couple logging framework

func NewLogger

func NewLogger(c *Config) (Logger, error)

NewLogger generates a new logger based on config

type LoggerType

type LoggerType int

LoggerType provide options for human readable or json output

const (
	MACHINE LoggerType = iota
	HUMAN
)

Logger Type

func ConvertToLoggerType

func ConvertToLoggerType(input string) LoggerType

ConvertToLoggerType convert input string to LoggerType no error is returned

Jump to

Keyboard shortcuts

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