Documentation ¶
Index ¶
Constants ¶
const ( // config keys LoggingDirectory = "logging.directory" LoggingActiveFileName = "logging.active_file_name" RotationMaxLines = "rotation.max_lines" RotationMaxFileSizeBytes = "rotation.max_file_size_bytes" FlushingTimeIntervalSecs = "flushing.time_interval_secs" PrependValue = "misc.prepend_value" FileRenamePolicy = "rollup.file_rename_policy" MaxAge = "rollup.max_age" MaxCount = "rollup.max_count" Gzip = "rollup.gzip" )
XXX: Move it to constants.go if needed
Variables ¶
var ( // ErrInvalidFileRenamePolicy is raised for invalid values to file rename policy ErrInvalidFileRenamePolicy = errors.New(FileRenamePolicy + " can only be timestamp or serial") // ErrInvalidMaxAge is raised for invalid value in max age - life bad suffixes or no integer value at all ErrInvalidMaxAge = errors.New(MaxAge + " must end with either d or h and start with a number") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { DirName string ActiveFileName string RotationMaxLines int RotationMaxBytes uint64 FlushingTimeIntervalSecs int PrependValue string FileRenamePolicy string MaxAge int64 MaxCount int Gzip bool }
Config holds all the config settings
type ConfigValueError ¶
type ConfigValueError struct {
Key string
}
ConfigValueError holds the error value if a config key contains an invalid value
func (*ConfigValueError) Error ¶
func (e *ConfigValueError) Error() string
type Consumer ¶
type Consumer struct { Config *Config LineProcessor LineProcessor Logger *syslog.Writer ReloadChan chan *Config // contains filtered or unexported fields }
Consumer is the main struct which holds all the stuff necessary to run the code
type LineProcessor ¶
LineProcessor interface is passed down to the consumer which just calls the write function
func GetLineProcessor ¶
func GetLineProcessor(cfg *Config) LineProcessor
GetLineProcessor function returns the particular processor depending on the config.
type NoProcessor ¶
type NoProcessor struct { }
NoProcessor is used when there is no prepend value. It just prints the line without any other action
type SimpleLineProcessor ¶
type SimpleLineProcessor struct {
// contains filtered or unexported fields
}
SimpleLineProcessor is used when the prependValue is only a simple string It just concatenates the string with the line and prints it
type TemplateLineProcessor ¶
type TemplateLineProcessor struct {
// contains filtered or unexported fields
}
TemplateLineProcessor is used when there is a template action in the prependValue It parses the prependValue and store the template. Then for every write call, it executes the template and writes it