/
loginit.go
40 lines (34 loc) · 983 Bytes
/
loginit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*-
* Copyright © 2017, Jörg Pernfuß <code.jpe@gmail.com>
* All rights reserved.
*
* Use of this source code is governed by a 2-clause BSD license
* that can be found in the LICENSE file.
*/
package erebos // import "github.com/mjolnir42/erebos"
import (
"io/ioutil"
"time"
"github.com/samuel/go-zookeeper/zk"
"github.com/sirupsen/logrus"
)
// DisableZKLogger is meant to be called in init() and will
// disable the package logger in github.com/samuel/go-zookeeper/zk
func DisableZKLogger() {
// Discard logspam from Zookeeper library
l := logrus.New()
l.Out = ioutil.Discard
zk.DefaultLogger = l
}
// SetLogrusOptions is meant to be called in init() and will
// set common Logrus options
func SetLogrusOptions() {
// set standard logger options
std := logrus.StandardLogger()
std.Formatter = &logrus.TextFormatter{
DisableColors: true,
FullTimestamp: true,
TimestampFormat: time.RFC3339Nano,
}
}
// vim: ts=4 sw=4 sts=4 noet fenc=utf-8 ffs=unix