log

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Filename        string `schema:"Имя файла,путь до файла в который будут записываться логи"`
	MaxSizeMb       int    `` /* 228-byte string literal not displayed */
	RotateTimeoutMs int    `` /* 228-byte string literal not displayed */
	Compress        bool   `schema:"Сжатие логов,архивирует файлы в gzip"`
	BufferSize      int    `` /* 149-byte string literal not displayed */
}

func (Config) GetBufferSize

func (c Config) GetBufferSize() int

func (Config) GetDirectory

func (c Config) GetDirectory() string

func (Config) GetFilePrefixAndExt

func (c Config) GetFilePrefixAndExt() (string, string)

func (Config) GetFilename

func (c Config) GetFilename() string

func (Config) GetMaxSizeInBytes

func (c Config) GetMaxSizeInBytes() int64

func (Config) GetRotateTimeout

func (c Config) GetRotateTimeout() time.Duration

func (Config) IsBuffered

func (c Config) IsBuffered() bool

func (Config) IsCompress

func (c Config) IsCompress() bool

type LogFile

type LogFile struct {
	os.FileInfo
	CreatedAt  time.Time
	FullPath   string
	Compressed bool
}

func CollectExistedLogs

func CollectExistedLogs(loggerConfig Config) ([]LogFile, error)

func MakeLogFile

func MakeLogFile(c Config, filepath string) (*LogFile, error)

type Logger

type Logger interface {
	io.WriteCloser
	Rotate() error
}

func NewDefaultLogger

func NewDefaultLogger(config Config, opts ...Option) Logger

type Option

type Option func(l *defaultLogger)

func WithAfterRotation

func WithAfterRotation(callback func(prevFile LogFile)) Option

Jump to

Keyboard shortcuts

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