Documentation
¶
Index ¶
- Constants
- type Logger
- type Option
- func WithCaller() Option
- func WithDelimiter(delimiter string) Option
- func WithFileWriter(addr string) Option
- func WithHttpListener(port int) Option
- func WithLocalWriter(tag string, priority syslog.Priority, bufferLen int) Option
- func WithLogLevel(level types.LogLevel) Option
- func WithNSQWriter(addr, topic string) Option
- func WithTCPConnection(addr, tag string, priority syslog.Priority, bufferLen int) Option
- func WithTimeLog(format string, loc *time.Location) Option
- func WithUDPConnection(addr, tag string, priority syslog.Priority, bufferLen int) Option
Constants ¶
const ( ConnectionTCP = types.ConnectionTCP ConnectionUDP = types.ConnectionUDP ConnectionLOCAL = types.ConnectionLOCAL ConnectionFILE = types.ConnectionFILE ConnectionNSQ = types.ConnectionNSQ )
Contains aliases for connection constants for easier access and usage
const ( EMERG = types.EMERG ALERT = types.ALERT CRIT = types.CRIT ERR = types.ERR WARN = types.WARN NOTIFY = types.NOTIFY INFO = types.INFO DEBUG = types.DEBUG FORCE = types.FORCE // force one of levels above = types.FORCE // force one of levels above )
Contains aliases for priority constants for easier access and usage
const ( DelimiterV = types.DelimiterV DelimiterH = types.DelimiterH DelimiterA = types.DelimiterA DefaultDelimiter = DelimiterV )
Contains aliases for delimiter constants for easier access and usage
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the main logging structure of this package
func NewDefaultLogger ¶
NewDefaultLogger creates new logger with default options: delimiter: " | " fileWriter in "/var/log/logger/" httpListener on 8080 port localWriter with ring buffer length=1 loglevel Debug and time format RFC3339 in UTC location mostly for testing purposes
func (*Logger) AddOptions ¶
AddOptions options add new options to existing logger should be used before first call of logger
type Option ¶
Option implements options pattern for Logger
func WithDelimiter ¶
WithDelimiter specifies message delimiter
func WithFileWriter ¶
WithFileWriter creates a log file at specified address
func WithHttpListener ¶
WithHttpListener creates new http-server for configuring logger and run it in a new goroutine
func WithLocalWriter ¶
WithLocalWriter adds a local syslog writer to Logger
func WithLogLevel ¶
WithLogLevel specifies the maximum allowed log level
func WithNSQWriter ¶
WithNSQWriter creates a simple connection to NSQ
func WithTCPConnection ¶
WithTCPConnection adds a tcp syslog writer to Logger
func WithTimeLog ¶
WithTimeLog specifies time format and location for logs