1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-12 19:20:40 +00:00

Fix ES bug

This commit is contained in:
Ming Deng
2020-06-29 21:53:52 +08:00
parent 9dea9f9ae7
commit 1f9da8d75b
4 changed files with 13 additions and 2 deletions

View File

@ -23,6 +23,12 @@ func NewES() logs.Logger {
return cw
}
// esLogger will log msg into ES
// before you using this implementation,
// please import this package
// usually means that you can import this package in your main package
// for example, anonymous:
// _ import github.com/astaxie/beego/logs/es
type esLogger struct {
*elasticsearch.Client
DSN string `json:"dsn"`
@ -43,7 +49,7 @@ func (el *esLogger) Init(jsonconfig string) error {
return errors.New("missing prefix")
} else {
conn, err := elasticsearch.NewClient(elasticsearch.Config{
Addresses: []string{u.Host},
Addresses: []string{el.DSN},
})
if err != nil {
return err