Documentation
¶
Overview ¶
Package parser contains the common configuration for the loggers parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { // Loggers is the list of loggers present in the configuration. Loggers []LoggerConfiguration `json:"loggers" yaml:"loggers" xml:"loggers>logger"` }
Configuration is a struct that represents the configuration.
func ReadFromJSON ¶
func ReadFromJSON(path string) (*Configuration, error)
ReadFromJSON reads the configuration from the JSON file and returns the configuration.
func ReadFromXML ¶
func ReadFromXML(path string) (*Configuration, error)
ReadFromXML reads the configuration from the XML file and returns the configuration.
func ReadFromYAML ¶
func ReadFromYAML(path string) (*Configuration, error)
ReadFromYAML reads the configuration from the YAML file and returns the configuration.
type EscapedString ¶
type EscapedString string
EscapedString is a type that represents a string that needs to be unescaped.
func (*EscapedString) UnmarshalXML ¶
func (escapedString *EscapedString) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal the escaped string from XML.
type FormatterConfiguration ¶
type FormatterConfiguration struct { // Type is the type of the formatter. Type string `json:"type" yaml:"type" xml:"type"` // PrettyPrint is a flag used by json formatter that indicates whether the // formatter should pretty print the output. PrettyPrint bool `json:"pretty-print" yaml:"pretty-print" xml:"pretty-print"` // KeyValueDelimiter is a delimiter used by key-value formatter to separate key // and value. KeyValueDelimiter string `json:"key-value-delimiter" yaml:"key-value-delimiter" xml:"key-value-delimiter"` // PairSeparator is a separator used by key-value formatter to separate key-value // pairs. PairSeparator string `json:"pair-separator" yaml:"pair-separator" xml:"pair-separator"` // Template is a template used by the formatter. Template TemplateConfiguration `json:"template" yaml:"template" xml:"template"` }
FormatterConfiguration is a struct that represents the configuration of a formatter.
type HandlerConfiguration ¶
type HandlerConfiguration struct { // Type is the type of the handler. Type string `json:"type" yaml:"type" xml:"type"` // FromLevel is the level from which the handler should log messages. FromLevel string `json:"from-level" yaml:"from-level" xml:"from-level"` // ToLevel is the level to which the handler should log messages. ToLevel string `json:"to-level" yaml:"to-level" xml:"to-level"` // File is the file used by the handler, it is needed for file handler to specify // where to write logs. File string `json:"file" yaml:"file" xml:"file"` // Formatter is the formatter used by the handler to format log messages. Formatter FormatterConfiguration `json:"formatter" yaml:"formatter" xml:"formatter"` }
HandlerConfiguration is a struct that represents the configuration of a handler.
type KeyValue ¶
KeyValue is a type that represents a key-value pair.
func (*KeyValue) MarshalXML ¶
MarshalXML marshals the key-value pairs into XML.
func (*KeyValue) UnmarshalXML ¶
UnmarshalXML unmarshal the key-value pairs from XML.
type LoggerConfiguration ¶
type LoggerConfiguration struct { // Name is the name of the logger. Name string `json:"name" yaml:"name" xml:"name"` // TimeFormat is the time format used by the logger. TimeFormat string `json:"time-format" yaml:"time-format" xml:"time-format"` // ErrorLevel is the error level used by the logger for raise/capture error. ErrorLevel string `json:"error-level" yaml:"error-level" xml:"error-level"` // PanicLevel is the panic level used by the logger for panic. PanicLevel string `json:"panic-level" yaml:"panic-level" xml:"panic-level"` // RequestTemplate is the template used by the logger for a request struct. RequestTemplate string `json:"request-template" yaml:"request-template" xml:"request-template"` // ResponseTemplate is the template used by the logger for a response struct. ResponseTemplate string `json:"response-template" yaml:"response-template" xml:"response-template"` // RequestMapping is the mapping used by the logger for a request struct. RequestMapping KeyValue `json:"request-mapping" yaml:"request-mapping" xml:"request-mapping"` // ResponseMapping is the mapping used by the logger for a response struct. ResponseMapping KeyValue `json:"response-mapping" yaml:"response-mapping" xml:"response-mapping"` // MessageQueueSize is the size of the message queue used by async logger. MessageQueueSize int `json:"message-queue-size" yaml:"message-queue-size" xml:"message-queue-size"` // Handlers is the list of handlers used by the logger. Handlers []HandlerConfiguration `json:"handlers" yaml:"handlers" xml:"handlers>handler"` }
LoggerConfiguration is a struct that represents the configuration of a logger.
type TemplateConfiguration ¶
type TemplateConfiguration struct { // StringValue is a string value used by the logger template. StringValue EscapedString `json:"string" yaml:"string" xml:"string"` // MapValue is a map value used by the structure logger template. MapValue KeyValue `json:"map" yaml:"map" xml:"map"` }
TemplateConfiguration is a struct that represents the configuration of a template.