74 lines
1.7 KiB
Go
74 lines
1.7 KiB
Go
package grlogs
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
)
|
|
|
|
type ConsoleLogConfig struct {
|
|
Level Level `json:"level"`
|
|
}
|
|
|
|
func (c *ConsoleLogConfig) String() string {
|
|
b, _ := json.Marshal(c)
|
|
return bytes.NewBuffer(b).String()
|
|
}
|
|
|
|
type FileLogConfig struct {
|
|
Filename string `json:"filename"`
|
|
Level Level `json:"level"`
|
|
Maxlines int `json:"maxlines"`
|
|
Daily bool `json:"daily"`
|
|
Maxdays int `json:"maxdays"`
|
|
Color bool `json:"color"`
|
|
Rotate bool `json:"rotate"`
|
|
}
|
|
|
|
func (c *FileLogConfig) String() string {
|
|
b, _ := json.Marshal(c)
|
|
return bytes.NewBuffer(b).String()
|
|
}
|
|
|
|
type ConnLogConfig struct {
|
|
ReconnectOnMsg bool `json:"reconnect_on_msg"`
|
|
Reconnect bool `json:"reconnect"`
|
|
Net string `json:"net"`
|
|
Addr string `json:"addr"`
|
|
Level Level `json:"level"`
|
|
}
|
|
|
|
func (c *ConnLogConfig) String() string {
|
|
b, _ := json.Marshal(c)
|
|
return bytes.NewBuffer(b).String()
|
|
}
|
|
|
|
type EsConfig struct {
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
Dsn string `json:"dsn"`
|
|
Level Level `json:"level"`
|
|
Index string `json:"index"`
|
|
}
|
|
|
|
func (c *EsConfig) String() string {
|
|
b, _ := json.Marshal(c)
|
|
return bytes.NewBuffer(b).String()
|
|
}
|
|
|
|
type AliLSConfig struct {
|
|
Project string `json:"project"`
|
|
Endpoint string `json:"endpoint"`
|
|
KeyID string `json:"key_id"`
|
|
KeySecret string `json:"key_secret"`
|
|
LogStore string `json:"log_store"`
|
|
Topics []string `json:"topics"`
|
|
Source string `json:"source"`
|
|
Level Level `json:"level"`
|
|
FlushWhen int `json:"flush_when"`
|
|
}
|
|
|
|
func (c *AliLSConfig) String() string {
|
|
b, _ := json.Marshal(c)
|
|
return bytes.NewBuffer(b).String()
|
|
}
|