mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Восстановлен логгинг метрик в statsd, если таковой указан в конфигурации
This commit is contained in:
30
bootstrap/bootstrap.go
Normal file
30
bootstrap/bootstrap.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/mono83/slf/rays"
|
||||
"github.com/mono83/slf/recievers/ansi"
|
||||
"github.com/mono83/slf/recievers/statsd"
|
||||
"github.com/mono83/slf/wd"
|
||||
)
|
||||
|
||||
func CreateLogger(statsdAddr string) (wd.Watchdog, error) {
|
||||
wd.AddReceiver(ansi.New(true, true, false))
|
||||
if statsdAddr != "" {
|
||||
hostname, _ := os.Hostname()
|
||||
statsdReceiver, err := statsd.NewReceiver(statsd.Config{
|
||||
Address: statsdAddr,
|
||||
Prefix: "ely.skinsystem." + hostname + ".app.",
|
||||
FlushEvery: 1,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
wd.AddReceiver(statsdReceiver)
|
||||
}
|
||||
|
||||
return wd.New("", "").WithParams(rays.Host), nil
|
||||
}
|
Reference in New Issue
Block a user