zaplog

package
v1.5.13 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package zaplog uses the zap logging library for application logs. There are two logging modes, development and production. The production mode saves the logs to file and automatically rotates older files. While the development mode prints all feedback to stdout.

Index

Constants

View Source
const (
	// ServerLog is the filename of the Error, Panic and Fatal level log.
	ServerLog = "defacto2_server_panics.log"
	// InfoLog is the filename of the Warn and Info level log.
	InfoLog = "defacto2_server_info.log"
	// MaxSizeMB is the maximum file size in megabytes before a log rotation is triggered.
	MaxSizeMB = 100
	// MaxBackups is the maximum number of rotated logs to keep, older logs are deleted.
	MaxBackups = 5
	// MaxDays is the maximum days a log is kept before a log rotation.
	MaxDays = 45
)

Variables

This section is empty.

Functions

func Debug

func Debug() *zap.Logger

Debug logger prints all log levels to stdout.

func Json added in v1.5.7

func Json() zapcore.Encoder

Json returns a logger in JSON format.

func Status

func Status() *zap.Logger

Status logger prints all log levels to stdout but without callers.

func Store

func Store(enc zapcore.Encoder, logPath string) *zap.Logger

Store logger prints all info and higher log levels to files using the encoder. Either the zaplog.JSON, zaplog.Text, or zaplog.TextNoTime encoders can be used. Fatal and Panics are also returned to os.Stderr.

func Text added in v1.5.7

func Text() zapcore.Encoder

Text returns a logger in color and time.

func TextNoTime added in v1.5.7

func TextNoTime() zapcore.Encoder

TextNoTime returns a logger in color but without the time.

func Timestamp

func Timestamp() *zap.Logger

Timestamp logger prints all log levels to stdout but without callers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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