Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigMQTT ¶
ConfigMQTT sets level for paho MQTT logging
Types ¶
type LogLevel ¶
type LogLevel int
LogLevel defines the logger levels.
const ( // ERROR is used to define the errors logging level. ERROR LogLevel = 1 + iota // WARN is used to define the errors and warnings logging level. WARN // INFO is used to define the errors, warnings and information logging level. INFO // DEBUG is used to define the errors, warnings, information and debug logging level. DEBUG // TRACE is used to define the more detailed logging level. TRACE )
func ParseLogLevel ¶
ParseLogLevel returns a LogLevel for a level string representation.
func (LogLevel) MarshalJSON ¶
MarshalJSON is used to marshal LogLevel.
func (LogLevel) StringAligned ¶
StringAligned returns the log level as string with padding.
func (*LogLevel) UnmarshalJSON ¶
UnmarshalJSON is used to unmarshal LogLevel.
type LogLevelDecorator ¶
type LogLevelDecorator struct {
// contains filtered or unexported fields
}
LogLevelDecorator is responsible for printing declaration depending on the level.
func NewLevelDecorator ¶
func NewLevelDecorator(logger *log.Logger, level LogLevel) LogLevelDecorator
NewLevelDecorator creates decorator for given logger and level instances.
func NewLevelDecoratorWithExporter ¶
func NewLevelDecoratorWithExporter(exporter Exporter, level LogLevel) LogLevelDecorator
NewLevelDecoratorWithExporter creates log level decorator with specified exporter.
func (LogLevelDecorator) Printf ¶
func (l LogLevelDecorator) Printf(format string, v ...interface{})
Printf formats the text while printing the data.
func (LogLevelDecorator) Println ¶
func (l LogLevelDecorator) Println(v ...interface{})
Println prints the values with a new line break.
type LogSettings ¶
type LogSettings struct { LogFile string `json:"logFile"` LogLevel LogLevel `json:"logLevel"` LogFileSize int `json:"logFileSize"` LogFileCount int `json:"logFileCount"` LogFileMaxAge int `json:"logFileMaxAge"` }
LogSettings defines the Logger configuration.
func (*LogSettings) Validate ¶
func (c *LogSettings) Validate() error
Validate validates the Logger settings.
type Logger ¶
type Logger interface { watermill.LoggerAdapter IsDebugEnabled() bool IsTraceEnabled() bool Warn(msg string, err error, fields watermill.LogFields) Errorf(format string, a ...interface{}) Warnf(format string, a ...interface{}) Infof(format string, a ...interface{}) Debugf(format string, a ...interface{}) Tracef(format string, a ...interface{}) }
Logger interface enables the loging functionality.
func NewLoggerWithExporter ¶
NewLoggerWithExporter creates a Logger instance with specified exporter.
func Setup ¶
func Setup(name string, settings *LogSettings) (io.WriteCloser, Logger)
Setup creates the logger instance with provided name and settings.