dugong

package module
v0.0.0-...-2b75352 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 8 Imported by: 2

README

dugong

Logging utilities for logrus.

To develop on this library, you need logrus on your GOPATH:

go get github.com/sirupsen/logrus

You can then run its tests by running

go test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFSHook

func NewFSHook(infoPath, warnPath, errorPath string, formatter log.Formatter, rotSched RotationScheduler) log.Hook

NewFSHook makes a logging hook that writes formatted log entries to info, warn and error log files. Each log file contains the messages with that severity or higher. If a formatter is not specified, they will be logged using a JSON formatter. If a RotationScheduler is set, the files will be cycled according to its rules.

Types

type DailyRotationSchedule

type DailyRotationSchedule struct {
	GZip bool
	// contains filtered or unexported fields
}

DailyRotationSchedule rotates log files daily. Logs are only rotated when midnight passes *whilst the process is running*. E.g: if you run the process on Day 4 then stop it and start it on Day 7, no rotation will occur when the process starts.

func (*DailyRotationSchedule) ShouldGZip

func (rs *DailyRotationSchedule) ShouldGZip() bool

func (*DailyRotationSchedule) ShouldRotate

func (rs *DailyRotationSchedule) ShouldRotate() (bool, string)

type RotationScheduler

type RotationScheduler interface {
	// ShouldRotate returns true if the file should be rotated. The suffix to apply
	// to the filename is returned as the 2nd arg.
	ShouldRotate() (bool, string)
	// ShouldGZip returns true if the file should be gzipped when it is rotated.
	ShouldGZip() bool
}

RotationScheduler determines when files should be rotated.

Jump to

Keyboard shortcuts

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