gepis_common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTypeLog     = "log"
	LogTypeRequest = "request"
)

Variables

This section is empty.

Functions

func ApplyOptionsToLoggers

func ApplyOptionsToLoggers(options *Options) error

Types

type LogLevel

type LogLevel string
const (
	DebugLevel     LogLevel = "debug"
	InfoLevel      LogLevel = "info"
	WarnLevel      LogLevel = "warn"
	ErrorLevel     LogLevel = "error"
	FatalLevel     LogLevel = "fatal"
	UndefinedLevel LogLevel = "undefined"
)

type Logger

type Logger interface {
	EnableJSONOutput(enabled bool)
	SetAppID(id string)
	SetOutputLevel(outputLevel LogLevel)
	WithLogType(logType string) Logger
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
}

func NewLogger

func NewLogger(name string) Logger

type Options

type Options struct {
	JSONFormatEnabled bool
	OutputLevel       string
	// contains filtered or unexported fields
}

func DefaultOptions

func DefaultOptions() Options

func (*Options) AttachCmdFlags

func (o *Options) AttachCmdFlags(
	stringVar func(p *string, name string, value string, usage string),
	boolVar func(p *bool, name string, value bool, usage string))

func (*Options) SetAppID

func (o *Options) SetAppID(id string)

func (*Options) SetOutputLevel

func (o *Options) SetOutputLevel(outputLevel string) error

Jump to

Keyboard shortcuts

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