appenders

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const CompressExt = ".gz"
View Source
const SpecialChar = ';'

Variables

This section is empty.

Functions

func AddExternalAppender

func AddExternalAppender(name string, f *func(config *pkg.AppenderConfig) pkg.Appender)

func ClearAppenderPool

func ClearAppenderPool()

func DateFileAppender

func DateFileAppender(config pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

DateFileAppender is a function that create an DateFile Appender

File appender config
{
	"type": "fileSync" (string),
	"filename": string
	"pattern": string (optional, defaults to 2006-01-02).
		The pattern to use to determine when to roll the logs.
		The pattern use the standard golang time format style.
	"maxLogSize": integer | string (OPTIONAL: default 0).
		The maximum size (in bytes) for the log file.
		If not specified or 0, then no log rolling will happen.
		maxLogSize can also accept string with the size suffixes: K, M, G such as 1K, 1M, 1G.
	"backups": integer (OPTIONAL: default 5).
		The number of old log files to keep during log rolling (excluding the hot file).
	"layout": a Layout. (already configured)
	"compress": boolean (default false)
		 compress the backup files using gzip (backup files will have .gz extension).
	"compressMode": int | string
		how to compress the file.
	"keepFileExt": boolean (default false)
		preserve the file extension when rotating log files (file.log becomes file.1.log instead of file.log.1).
	"fileNameSep": string (default ".")
}

func FileAppender

func FileAppender(config pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

FileAppender is a function that creates an Appender of type

File appender config
{
	"type": "fileSync" (string),
	"filename": string
	"maxLogSize": integer | string (OPTIONAL: default 0).
		The maximum size (in bytes) for the log file.
		If not specified or 0, then no log rolling will happen.
		maxLogSize can also accept string with the size suffixes: K, M, G such as 1K, 1M, 1G.
	"backups": integer (OPTIONAL: default 5).
		The number of old log files to keep during log rolling (excluding the hot file).
	"layout": a Layout. (already configured)
	"compress": boolean (default false)
		 compress the backup files using gzip (backup files will have .gz extension).
	"compressMode": int | string
		how to compress the file
	"keepFileExt": boolean (default false)
		preserve the file extension when rotating log files (file.log becomes file.1.log instead of file.log.1).
	"fileNameSep": string (default ".")
}

func FileSyncAppender

func FileSyncAppender(config pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

FileSyncAppender is a function that creates an Appender of type

FileSync appender config
{
	"type": "fileSync" (string),
	"filename": string
	"maxLogSize": integer | string (OPTIONAL: default 0).
		The maximum size (in bytes) for the log file.
		If not specified or 0, then no log rolling will happen.
		maxLogSize can also accept string with the size suffixes: K, M, G such as 1K, 1M, 1G.
	"backups": integer (OPTIONAL: default 5).
		The number of old log files to keep during log rolling (excluding the hot file).
	"layout": a Layout. (already configured)
	"compressMode": how to compress the file
}

func HttpAppender

func HttpAppender(config pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

func NetworkAppender

func NetworkAppender(config pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

func StderrAppender

func StderrAppender(_ pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

func StdoutAppender

func StdoutAppender(_ pkg.AppenderConfig, layout *pkg.Layout) pkg.Appender

Types

type AppenderHandler

type AppenderHandler struct {
	CloseChannel   func()
	WriteOnChannel func(event *pkg.LoggingEvent)
	Start          func()
}

func NewAppenderHandler

func NewAppenderHandler(config pkg.AppenderConfig, globalAppenderWaitGroup *sync.WaitGroup) *AppenderHandler

type AppenderPool

type AppenderPool map[string]*AppenderHandler

func NewAppenderPool

func NewAppenderPool(c pkg.AppendersConfig, globalAppenderWaitGroup *sync.WaitGroup) AppenderPool

NewAppenderPool This function create a pool of appenders. Returns a map[string]Appender. In other words, this function create a concrete map starting from a configuration

type Comparator

type Comparator struct {
	// contains filtered or unexported fields
}

func NewComparator

func NewComparator(fullPath string, sep string, keepFileExt, isCompress bool) *Comparator

func (*Comparator) Match

func (c *Comparator) Match(s string) int

Match This method return -1 if no matching; 0 if it is the hot file greater than 0 if there is a matching

func (*Comparator) Replace

func (c *Comparator) Replace(i int) string

type DateComparator

type DateComparator struct {
	// contains filtered or unexported fields
}

DateComparator struct

func NewDateComparator

func NewDateComparator(fullPath string, sep string, keepFileExt, isCompress bool, datePattern string) DateComparator

func (*DateComparator) Match

func (d *DateComparator) Match(s string) int

Match return the difference between now and the date saved -1

func (*DateComparator) Replace

func (d *DateComparator) Replace(i int) string

type DateComparatorII

type DateComparatorII struct {
	// contains filtered or unexported fields
}

func NewDateComparatorII

func NewDateComparatorII(fullPath string, sep string, keepFileExt, isCompress bool, datePattern string) DateComparatorII

func (*DateComparatorII) Match

func (d *DateComparatorII) Match(s string) (int64, int)

Match return the difference between now and the date saved -1

func (*DateComparatorII) Replace

func (d *DateComparatorII) Replace(i int) string

func (*DateComparatorII) ReplaceWithDifferentDate

func (d *DateComparatorII) ReplaceWithDifferentDate(i int, date time.Time) string

type DateFileManagerI

type DateFileManagerI struct {
	// contains filtered or unexported fields
}

type DateFileManagerII

type DateFileManagerII struct {
	// contains filtered or unexported fields
}

type FileConfig

type FileConfig struct {
	// contains filtered or unexported fields
}

type FileManager

type FileManager struct {
	// contains filtered or unexported fields
}

type FileManagerFactory

type FileManagerFactory func(config *FileConfig) IFileManagerRotation

type IFileManagerRotation

type IFileManagerRotation interface {
	// contains filtered or unexported methods
}

IFileManagerRotation This interface defines methods for file's manager appenders.

Jump to

Keyboard shortcuts

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