Documentation
¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Hub() *loggerHub
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func NewTeeLogWriter(writers ...LoggerWriter)
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func SetLevel(l LogLevel)
- func SetWriter(w LoggerWriter, level LogLevel)
- func StripColors(x []byte) []byte
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warning(args ...interface{})
- func Warningf(format string, args ...interface{})
- type CborFormatter
- func (s *CborFormatter) Colorize(b bool)
- func (s *CborFormatter) Colorized() bool
- func (s *CborFormatter) FieldSeparator() string
- func (s *CborFormatter) FormatHost(s2 string) string
- func (s *CborFormatter) FormatLevel(level LogLevel) LevelFormat
- func (s *CborFormatter) FormatMessage(name, host, message string, t time.Time, l LogLevel) (x []byte, err error)
- func (s *CborFormatter) FormatName(s2 string) string
- func (s *CborFormatter) FormatTime(t time.Time) string
- func (s *CborFormatter) MessageSeparator() string
- func (s *CborFormatter) MessageTerminator() string
- func (s *CborFormatter) StreamStarter() string
- func (s *CborFormatter) StreamTerminator() string
- type ConsoleLogWriter
- type DefaultFormatter
- func (d *DefaultFormatter) Colorize(b bool)
- func (d *DefaultFormatter) Colorized() bool
- func (d *DefaultFormatter) FieldSeparator() string
- func (d *DefaultFormatter) FormatHost(s string) string
- func (d *DefaultFormatter) FormatLevel(level LogLevel) (t LevelFormat)
- func (d *DefaultFormatter) FormatMessage(name, host, message string, t time.Time, level LogLevel) ([]byte, error)
- func (d *DefaultFormatter) FormatName(s string) string
- func (d *DefaultFormatter) FormatTime(t time.Time) string
- func (d *DefaultFormatter) MessageSeparator() string
- func (d *DefaultFormatter) MessageTerminator() string
- func (d *DefaultFormatter) StreamStarter() string
- func (d *DefaultFormatter) StreamTerminator() string
- type FileLogWriter
- func (f *FileLogWriter) Close() error
- func (f *FileLogWriter) Colorize() bool
- func (f *FileLogWriter) SetCompression(should bool)
- func (f *FileLogWriter) SetNoRotation()
- func (f *FileLogWriter) SetRotationByDay()
- func (f *FileLogWriter) SetRotationBySize(maxSize int64)
- func (f *FileLogWriter) Write(p []byte) (n int, err error)
- type Formatter
- type LevelFormat
- type LogCompression
- type LogLevel
- type LogMessage
- type LogMessageDecoder
- type LogRotate
- type Logger
- type LoggerWriter
- type MqttReceiver
- type NullLoggerWriter
- type TeeLoggerWriter
- type XLogger
- func (x *XLogger) Close()
- func (x *XLogger) Debug(args ...interface{})
- func (x *XLogger) Debugf(format string, args ...interface{})
- func (x *XLogger) Error(args ...interface{})
- func (x *XLogger) Errorf(format string, args ...interface{})
- func (x *XLogger) Fatal(args ...interface{})
- func (x *XLogger) Fatalf(format string, args ...interface{})
- func (x *XLogger) Info(args ...interface{})
- func (x *XLogger) Infof(format string, args ...interface{})
- func (x *XLogger) LogStruct(m LogMessage)
- func (x *XLogger) Panic(args ...interface{})
- func (x *XLogger) Panicf(format string, args ...interface{})
- func (x *XLogger) Print(args ...interface{})
- func (x *XLogger) Printf(format string, args ...interface{})
- func (x *XLogger) SetFormatter(y Formatter)
- func (x *XLogger) SetLevel(l LogLevel)
- func (x *XLogger) SetWriter(w LoggerWriter, level LogLevel)
- func (x *XLogger) Warn(args ...interface{})
- func (x *XLogger) Warnf(format string, args ...interface{})
- func (x *XLogger) Warning(args ...interface{})
- func (x *XLogger) Warningf(format string, args ...interface{})
- func (x *XLogger) WriterForStdLogger(level LogLevel) io.Writer
Constants ¶
View Source
const ( DefaultLoggingTimeFormat = "Mon 02.01.2006 15:04:05.00000" DefaultLoggerFieldSeparator = "," DefaultLoggerMessageTerminator = "\n" DefaultLoggerMessageSeparator = "-> " )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(args ...interface{})
func Error ¶
func Error(args ...interface{})
func Fatal ¶
func Fatal(args ...interface{})
func Hub ¶
func Hub() *loggerHub
func Info ¶
func Info(args ...interface{})
func NewTeeLogWriter ¶
func NewTeeLogWriter(writers ...LoggerWriter)
func Panic ¶
func Panic(args ...interface{})
func Print ¶
func Print(args ...interface{})
func SetWriter ¶
func SetWriter(w LoggerWriter, level LogLevel)
func Warn ¶
func Warn(args ...interface{})
func Warning ¶
func Warning(args ...interface{})
Types ¶
type CborFormatter ¶
type CborFormatter struct{}
func (*CborFormatter) Colorize ¶
func (s *CborFormatter) Colorize(b bool)
func (*CborFormatter) Colorized ¶
func (s *CborFormatter) Colorized() bool
func (*CborFormatter) FieldSeparator ¶
func (s *CborFormatter) FieldSeparator() string
func (*CborFormatter) FormatHost ¶
func (s *CborFormatter) FormatHost(s2 string) string
func (*CborFormatter) FormatLevel ¶
func (s *CborFormatter) FormatLevel(level LogLevel) LevelFormat
func (*CborFormatter) FormatMessage ¶
func (*CborFormatter) FormatName ¶
func (s *CborFormatter) FormatName(s2 string) string
func (*CborFormatter) FormatTime ¶
func (s *CborFormatter) FormatTime(t time.Time) string
func (*CborFormatter) MessageSeparator ¶
func (s *CborFormatter) MessageSeparator() string
func (*CborFormatter) MessageTerminator ¶
func (s *CborFormatter) MessageTerminator() string
func (*CborFormatter) StreamStarter ¶
func (s *CborFormatter) StreamStarter() string
func (*CborFormatter) StreamTerminator ¶
func (s *CborFormatter) StreamTerminator() string
type ConsoleLogWriter ¶
type ConsoleLogWriter struct {
// contains filtered or unexported fields
}
func (*ConsoleLogWriter) Close ¶
func (c *ConsoleLogWriter) Close() error
func (*ConsoleLogWriter) Colorize ¶
func (c *ConsoleLogWriter) Colorize() bool
func (*ConsoleLogWriter) UseColors ¶
func (c *ConsoleLogWriter) UseColors(should bool)
func (*ConsoleLogWriter) UseStderr ¶
func (c *ConsoleLogWriter) UseStderr(should bool)
func (*ConsoleLogWriter) Write ¶
func (c *ConsoleLogWriter) Write(p []byte) (n int, err error)
type DefaultFormatter ¶
type DefaultFormatter struct {
// contains filtered or unexported fields
}
func (*DefaultFormatter) Colorize ¶
func (d *DefaultFormatter) Colorize(b bool)
func (*DefaultFormatter) Colorized ¶
func (d *DefaultFormatter) Colorized() bool
func (*DefaultFormatter) FieldSeparator ¶
func (d *DefaultFormatter) FieldSeparator() string
func (*DefaultFormatter) FormatHost ¶
func (d *DefaultFormatter) FormatHost(s string) string
func (*DefaultFormatter) FormatLevel ¶
func (d *DefaultFormatter) FormatLevel(level LogLevel) (t LevelFormat)
func (*DefaultFormatter) FormatMessage ¶
func (*DefaultFormatter) FormatName ¶
func (d *DefaultFormatter) FormatName(s string) string
func (*DefaultFormatter) FormatTime ¶
func (d *DefaultFormatter) FormatTime(t time.Time) string
func (*DefaultFormatter) MessageSeparator ¶
func (d *DefaultFormatter) MessageSeparator() string
func (*DefaultFormatter) MessageTerminator ¶
func (d *DefaultFormatter) MessageTerminator() string
func (*DefaultFormatter) StreamStarter ¶
func (d *DefaultFormatter) StreamStarter() string
func (*DefaultFormatter) StreamTerminator ¶
func (d *DefaultFormatter) StreamTerminator() string
type FileLogWriter ¶
type FileLogWriter struct {
// contains filtered or unexported fields
}
func NewFileLogWriter ¶
func NewFileLogWriter(path string, perm int) (z *FileLogWriter, err error)
func (*FileLogWriter) Close ¶
func (f *FileLogWriter) Close() error
func (*FileLogWriter) Colorize ¶
func (f *FileLogWriter) Colorize() bool
func (*FileLogWriter) SetCompression ¶
func (f *FileLogWriter) SetCompression(should bool)
func (*FileLogWriter) SetNoRotation ¶
func (f *FileLogWriter) SetNoRotation()
func (*FileLogWriter) SetRotationByDay ¶
func (f *FileLogWriter) SetRotationByDay()
func (*FileLogWriter) SetRotationBySize ¶
func (f *FileLogWriter) SetRotationBySize(maxSize int64)
func (*FileLogWriter) Write ¶
func (f *FileLogWriter) Write(p []byte) (n int, err error)
type Formatter ¶
type Formatter interface { StreamStarter() string StreamTerminator() string FieldSeparator() string MessageTerminator() string MessageSeparator() string FormatTime(time.Time) string FormatName(string) string FormatHost(string) string FormatMessage(name, host, message string, t time.Time, l LogLevel) ([]byte, error) FormatLevel(level LogLevel) LevelFormat Colorize(bool) Colorized() bool }
type LogCompression ¶
type LogCompression int
const ( NoCompression LogCompression = iota CompressGzip )
type LogMessage ¶
type LogMessage struct { Time string `cbor:"t" json:"t"` Message string `cbor:"m" json:"m"` Level LogLevel `cbor:"l" json:"l"` Name string `cbor:"n" json:"n"` Host string `cbor:"h" json:"h"` }
func CborDecoder ¶
func CborDecoder(src []byte) (x LogMessage, err error)
type LogMessageDecoder ¶
type LogMessageDecoder func([]byte) (LogMessage, error)
type Logger ¶
type Logger interface { LogStruct(message LogMessage) Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Printf(format string, args ...interface{}) Warnf(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Print(args ...interface{}) Warn(args ...interface{}) Warning(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Panic(args ...interface{}) Close() }
type LoggerWriter ¶
type LoggerWriter interface { io.WriteCloser Colorize() bool }
type MqttReceiver ¶
type MqttReceiver struct { Client mqtt.Client Topic string Logger Logger MessageDecoder LogMessageDecoder }
func (*MqttReceiver) StartListening ¶
func (x *MqttReceiver) StartListening(topic string)
func (*MqttReceiver) StopListening ¶
func (x *MqttReceiver) StopListening()
type NullLoggerWriter ¶
type NullLoggerWriter struct { }
func (*NullLoggerWriter) Close ¶
func (n2 *NullLoggerWriter) Close() error
func (*NullLoggerWriter) Colorize ¶
func (n2 *NullLoggerWriter) Colorize() bool
func (*NullLoggerWriter) Write ¶
func (n2 *NullLoggerWriter) Write(p []byte) (n int, err error)
type TeeLoggerWriter ¶
type TeeLoggerWriter struct {
// contains filtered or unexported fields
}
func (*TeeLoggerWriter) Close ¶
func (t *TeeLoggerWriter) Close() error
func (*TeeLoggerWriter) Colorize ¶
func (t *TeeLoggerWriter) Colorize() (yes bool)
func (*TeeLoggerWriter) Write ¶
func (t *TeeLoggerWriter) Write(p []byte) (n int, err error)
type XLogger ¶
type XLogger struct {
// contains filtered or unexported fields
}
func (*XLogger) LogStruct ¶
func (x *XLogger) LogStruct(m LogMessage)
func (*XLogger) SetWriter ¶
func (x *XLogger) SetWriter(w LoggerWriter, level LogLevel)
Source Files
¶
- cbor_message_decoder.go
- cbor_message_formatter.go
- console_writer.go
- default_formatter.go
- default_logger.go
- doc.go
- file_constants.go
- file_writer.go
- formatter.go
- hub.go
- level.go
- level_format.go
- logger.go
- message.go
- message_decoder.go
- mqtt_receiver.go
- nullwriter.go
- strip_colors.go
- tee_writer.go
- writer.go
- xlogger.go
Click to show internal directories.
Click to hide internal directories.