Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // DebugLevel defines debug log level. DebugLevel = iota // InfoLevel defines info log level. InfoLevel // WarnLevel defines warn log level. WarnLevel // ErrorLevel defines error log level. ErrorLevel // FatalLevel defines fatal log level. FatalLevel // PanicLevel defines panic log level. PanicLevel // NoLevel defines an absent log level. NoLevel // Disabled disables the logger. Disabled // TraceLevel defines trace log level. TraceLevel = -1 )
View Source
const ( ReceiverEs int = iota + 1 ReceiverStdout ReceiverPp ReceiverDump )
Variables ¶
Functions ¶
func LevelString ¶
Types ¶
type EsLogger ¶
type EsLogger struct {
// contains filtered or unexported fields
}
EsLogger an elastic writer can be used for zerolog
func NewEsLogger ¶
Example ¶
_, err := NewEsLogger() fmt.Println(err == ErrServersRequired) _, err = NewEsLogger(WithUrls("")) fmt.Println(err == ErrServerIsEmpty) urls := []string{"http://127.0.0.1:10000"} _, err = NewEsLogger(WithUrls(urls...)) fmt.Println(err == ErrServerIsEmpty) fmt.Println(err == ErrIndexRequired) _, err = NewEsLogger( WithUrls(urls...), WithIndexName("test"), WithLevel(DebugLevel), WithUsername("xxx"), WithPassword("xxx"), ) fmt.Println(err != nil)
Output: true true false false true
type EsOption ¶
type EsOption func(o *Option)
func WithIndexName ¶
func WithPassword ¶
func WithReceiver ¶
func WithUsername ¶
type MyRetrier ¶
type MyRetrier struct {
// contains filtered or unexported fields
}
MyRetrier this is copied from https://github.com/olivere/elastic/wiki/Retrier-and-Backoff
type Option ¶
type Option struct { // the log Receiver: is not used by now Receiver int `json:"receiver" yaml:"receiver" redis:"receiver" structs:"receiver"` Disabled bool `json:"disabled" yaml:"disabled" redis:"disabled" structs:"disabled"` // log Level Level int `json:"level" yaml:"level" redis:"level" structs:"level"` // Retries Retries int `json:"retries" yaml:"retries" redis:"retries" structs:"retries"` // Timeout Timeout int `json:"timeout" yaml:"timeout" redis:"timeout" structs:"timeout"` // index name for es IndexName string `json:"index_name" yaml:"index_name" redis:"index_name" structs:"index_name"` IndexSuffix string `json:"index_suffix" yaml:"index_suffix" redis:"index_suffix" structs:"index_suffix"` // Urls Urls []string `json:"urls" yaml:"urls" redis:"urls" structs:"urls"` // WithFuncName WithFuncName bool `json:"with_func_name" yaml:"with_func_name" redis:"with_func_name" structs:"with_func_name"` WithSysinfo bool `json:"with_sysinfo" yaml:"with_sysinfo" redis:"with_sysinfo" structs:"with_sysinfo"` // basic auth Username string `json:"username" yaml:"username" redis:"username" structs:"username"` Password string `json:"password" yaml:"password" redis:"password" structs:"password"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.