zlog

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = LogConfig{
	Level:   "debug",
	Pattern: production,
	Output:  "stdout",
	LogRotate: LogRotate{
		Filename:   "app.log",
		MaxSize:    100,
		MaxBackups: 3,
		MaxAge:     7,
		Compress:   true,
	},
}

Functions

This section is empty.

Types

type LogConfig

type LogConfig struct {
	Level     string    `yaml:"Level"`
	Pattern   string    `yaml:"Pattern"`
	Output    string    `yaml:"Output"`
	LogRotate LogRotate `yaml:"LogRotate"`
}

LogConfig holds the configuration for the logger

type LogHTTPWriter

type LogHTTPWriter struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func NewLogHTTPWriter

func NewLogHTTPWriter(serverURL string, warnOnHttpErr bool) *LogHTTPWriter

func (*LogHTTPWriter) Write

func (w *LogHTTPWriter) Write(p []byte) (n int, err error)

type LogRotate

type LogRotate struct {
	Filename   string `yaml:"Filename"`
	MaxSize    int    `yaml:"MaxSize"`
	MaxBackups int    `yaml:"MaxBackups"`
	MaxAge     int    `yaml:"MaxAge"`
	Compress   bool   `yaml:"Compress"`
}

LogRotate holds the configuration for log rotation

type Logger

type Logger interface {
	Trace(message string, args ...interface{})
	Debug(message string, args ...interface{})
	Info(message string, args ...interface{})
	Warn(message string, args ...interface{})
	Error(message string, args ...interface{})
	Fatal(message string, args ...interface{})
	Panic(message string, args ...interface{})

	Tracef(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	SetConfig(config LogConfig)
	GetConfig() LogConfig
	IsTraceEnabled() bool
	IsDebugEnabled() bool
	IsInfoEnabled() bool
	IsWarnEnabled() bool
	IsErrorEnabled() bool
	IsFatalEnabled() bool
	IsPanicEnabled() bool
}

Logger interface defines the logging methods

func GetLogger

func GetLogger() Logger

GetLogger returns the global logger instance

Directories

Path Synopsis
httpServer command

Jump to

Keyboard shortcuts

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