Documentation ¶
Overview ¶
Clog is a channel-based logging package for Go.
Index ¶
- Constants
- func Delete(mode MODE)
- func Error(skip int, format string, v ...interface{})
- func Fatal(skip int, format string, v ...interface{})
- func Info(format string, v ...interface{})
- func New(mode MODE, cfg interface{}) error
- func Register(mode MODE, f Factory)
- func Shutdown()
- func Trace(format string, v ...interface{})
- func Version() string
- func Warn(format string, v ...interface{})
- func Write(level LEVEL, skip int, format string, v ...interface{})
- type Adapter
- type ConsoleConfig
- type ErrConfigObject
- type ErrInvalidLevel
- type Factory
- type FileConfig
- type FileRotationConfig
- type LEVEL
- type Logger
- type MODE
- type Message
- type SlackConfig
Constants ¶
View Source
const ( FILE MODE = "file" SIMPLE_DATE_FORMAT = "2006-01-02" LOG_PREFIX_LENGTH = len("2017/02/06 21:20:08 ") )
View Source
const (
SLACK = "slack"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter contains common fields for any logger adapter. This struct should be used as embedded struct.
type ConsoleConfig ¶
type ErrConfigObject ¶
type ErrConfigObject struct {
// contains filtered or unexported fields
}
func (ErrConfigObject) Error ¶
func (err ErrConfigObject) Error() string
type ErrInvalidLevel ¶
type ErrInvalidLevel struct{}
func (ErrInvalidLevel) Error ¶
func (err ErrInvalidLevel) Error() string
type FileConfig ¶
type FileConfig struct { // Minimum level of messages to be processed. Level LEVEL // Buffer size defines how many messages can be queued before hangs. BufferSize int64 // File name to outout messages. Filename string // Rotation related configurations. FileRotationConfig }
type FileRotationConfig ¶
type FileRotationConfig struct { // Do rotation for output files. Rotate bool // Rotate on daily basis. Daily bool // Maximum size in bytes of file for a rotation. MaxSize int64 // Maximum number of lines for a rotation. MaxLines int64 // Maximum lifetime of a output file in days. MaxDays int64 }
FileRotationConfig represents rotation related configurations for file mode logger. All the settings can take effect at the same time, remain zero values to disable them.
type Logger ¶
type Logger interface { // Level returns minimum level of given logger. Level() LEVEL // Init accepts a config struct specific for given logger and performs any necessary initialization. Init(interface{}) error // ExchangeChans accepts error channel, and returns message receive channel. ExchangeChans(chan<- error) chan *Message // Start starts message processing. Start() // Destroy releases all resources. Destroy() }
Logger is an interface for a logger adapter with specific mode and level.
type SlackConfig ¶
Click to show internal directories.
Click to hide internal directories.