log

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClientLogFileExt is used as extension by all main teamclients log files by default.
	ClientLogFileExt = "teamclient.log"
	// ServerLogFileExt is used as extension by all teamservers core log files by default.
	ServerLogFileExt = "teamserver.log"
)
View Source
const PackageFieldKey = "teamserver_pkg"

PackageFieldKey is used to identify the name of the package specified by teamclients and teamservers named loggers.

Variables

This section is empty.

Functions

func FileName

func FileName(name string, server bool) string

FileName take a filename without extension and adds the corresponding teamserver/teamclient logfile extension.

func Init

func Init(fs *assets.FS, file string, level logrus.Level) (*logrus.Logger, *logrus.Logger, error)

Init is the main constructor that is (and should be) used for teamserver and teamclient logging. It hooks a normal logger with a sublogger writing to a file in text version, and another logger writing to stdout/stderr with enhanced formatting/coloring support.

func IsWritable

func IsWritable(path string) (isWritable bool, err error)

IsWritable checks that the given path can be created.

func LevelFrom

func LevelFrom(level int) logrus.Level

LevelFrom - returns level from int.

func NewAudit

func NewAudit(fs *assets.FS, logDir string) (*logrus.Logger, error)

NewAudit returns a logger writing to an audit file in JSON format.

func NewDatabase

func NewDatabase(log *logrus.Entry, level string) logger.Interface

NewDatabase returns a logger suitable as logrus database logging middleware.

func NewJSON

func NewJSON(fs *assets.FS, file string, level logrus.Level) (*logrus.Logger, error)

NewJSON returns a logger writing to the central log file of the teamserver, JSON-encoded.

func NewStdio

func NewStdio(level logrus.Level) *logrus.Logger

NewStdio returns a logger configured to output its events to the system stdio: - Info/Debug/Trace logs are written to os.Stdout. - Warn/Error/Fatal/Panic are written to os.Stderr.

func NewText

func NewText(file io.Writer) (*logrus.Logger, error)

NewText returns a new logger writing to a given file. The formatting is enhanced for informative debugging and call stack reporting, but without any special coloring/formatting.

Types

This section is empty.

Jump to

Keyboard shortcuts

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