logging

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 6 Imported by: 4

Documentation

Overview

Copyright 2023 Christopher Briscoe. All rights reserved.

Index

Constants

This section is empty.

Variables

View Source
var (
	Nop = &Logger{
		Logger: &nop,
		roller: nil,
	}
)

Nop is a no-operation logger instance with no roller attached

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseDir    string        `json:"basedir"`
	FileName   string        `json:"filename"`
	MaxAge     time.Duration `json:"maxage"`
	MaxSize    int64         `json:"maxsize"`
	MaxBackups int           `json:"maxbackups"`
	Console    bool          `json:"console"`
	Compress   bool          `json:"compress"`
}

Config stores the information required to start a new logger

type Logger

type Logger struct {
	*zerolog.Logger
	// contains filtered or unexported fields
}

Logger contains a zerolog.Logger for logging functions and a lumberjack.Roller reference so that we can call Rotate() on our own schedule if desired

func NewLogger

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

NewLogger returns a new rolling logger based on the config parameters used

func (*Logger) Rotate

func (l *Logger) Rotate() error

Rotate will immediately close and rotate the current log file

Jump to

Keyboard shortcuts

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