Documentation ¶
Index ¶
- Constants
- type ESLogger
- type ESLoggerConfig
- func (eslc *ESLoggerConfig) BasicAuth(user, pass string) *ESLoggerConfig
- func (eslc *ESLoggerConfig) BufMaxSize(maxSize int) *ESLoggerConfig
- func (eslc *ESLoggerConfig) DisableTimestamp()
- func (eslc *ESLoggerConfig) Loggger(logger *log.Logger) *ESLoggerConfig
- func (eslc *ESLoggerConfig) Tick(d time.Duration) *ESLoggerConfig
- func (eslc *ESLoggerConfig) Transport(rp http.RoundTripper) *ESLoggerConfig
Constants ¶
const ( DefaultMaxSize = 4096 DefaultDuration = time.Millisecond * 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ESLogger ¶
type ESLogger struct {
// contains filtered or unexported fields
}
ESLogger encode keyvals into json object. and store in a internal buf. the buf content will be synced to elastich search datastream in tick period or if buf size exceed bufMaxSize
func New ¶
func New(eslc *ESLoggerConfig) *ESLogger
New create a new ESLogger instrance with eslc config
type ESLoggerConfig ¶
type ESLoggerConfig struct {
// contains filtered or unexported fields
}
ESLoggerConfig define the config property which used to create ESlogger instance
func NewConfig ¶
func NewConfig(address string, streamName string) *ESLoggerConfig
NewConfig return a new ESLoggerConfig with sepcifc address(scheme://ip:port) and streamName
func (*ESLoggerConfig) BasicAuth ¶
func (eslc *ESLoggerConfig) BasicAuth(user, pass string) *ESLoggerConfig
BasicAuth set user, password which used to basic authentication
func (*ESLoggerConfig) BufMaxSize ¶
func (eslc *ESLoggerConfig) BufMaxSize(maxSize int) *ESLoggerConfig
BufMaxSize sepcific internal buf maxSize instread of DefaultMaxSize
func (*ESLoggerConfig) DisableTimestamp ¶
func (eslc *ESLoggerConfig) DisableTimestamp()
DisabledTimeatmp disable automatically add the '@timestamp' field
func (*ESLoggerConfig) Loggger ¶
func (eslc *ESLoggerConfig) Loggger(logger *log.Logger) *ESLoggerConfig
Logger spcific logger instance which used to write error log during sync process
func (*ESLoggerConfig) Tick ¶
func (eslc *ESLoggerConfig) Tick(d time.Duration) *ESLoggerConfig
Tick specific sync duration instead of DefaultDuration
func (*ESLoggerConfig) Transport ¶
func (eslc *ESLoggerConfig) Transport(rp http.RoundTripper) *ESLoggerConfig
Transport sepcific transport instance which used to build elastic client if not specific the default http.Transport will be used