Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Filename where the log is stored. Filename string `yaml:"filename" mapstructure:"filename"` // Directory where the log files are stored. Directory string `yaml:"directory" mapstructure:"directory"` // Timestamp format when rotation files. FileTimestampFormat string `yaml:"file_timestamp_format" mapstructure:"file_timestamp_format"` // Maximum filesize, the log is rotated when this size is exceeded. MaxFileSize types.Size `yaml:"maxfilesize" mapstructure:"maxfilesize"` // Maximum lifetime of the file before it is rotated. MaxTime time.Duration `yaml:"maxtime" mapstructure:"maxtime"` }
Config represents configuration parameters for a log.
func (Config) GetDirectory ¶
func (Config) GetFilePath ¶
func (Config) GetFilename ¶
type HookWriter ¶
func MakeErrorHook ¶
func MakeErrorHook(writer io.Writer) *HookWriter
func MakeStdHook ¶
func MakeStdHook(writer io.Writer) *HookWriter
func (*HookWriter) Levels ¶
func (hook *HookWriter) Levels() []log.Level
type RotatingFile ¶
type RotatingFile struct {
// contains filtered or unexported fields
}
Rotating file represents a file that can be rotated when either the file becomes to large or to old, whatever comes first
func NewRotatingFile ¶
func NewRotatingFile(filename string, opts ...RotatingFileOption) (*RotatingFile, error)
Open a new rotating file.
func NewRotatingFileFromConfig ¶
func NewRotatingFileFromConfig(config Config, suffix string) (*RotatingFile, error)
Open a new rotating file using a config struct.
type RotatingFileOption ¶
type RotatingFileOption func(*RotatingFile)
func WithMaxAge ¶
func WithMaxAge(value time.Duration) RotatingFileOption
func WithMaxSize ¶
func WithMaxSize(value int64) RotatingFileOption
func WithTimestampFormat ¶
func WithTimestampFormat(value string) RotatingFileOption
Click to show internal directories.
Click to hide internal directories.