summaryrefslogtreecommitdiffhomepage
path: root/bgpd.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 05:19:07 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 05:19:07 -0800
commit13e9aefa1d7ec92600d46a004d5f38a4ff95ac7e (patch)
treeb88dd27679b4a891bd6218498123811ab0d85596 /bgpd.go
parenta5874d6912e2286fa5af5dc452e3d99ebc38c7a5 (diff)
add --log-json command line option
During development, it's easy to parse a plain format by human. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'bgpd.go')
-rw-r--r--bgpd.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/bgpd.go b/bgpd.go
index 38e5c849..8e9effd3 100644
--- a/bgpd.go
+++ b/bgpd.go
@@ -37,6 +37,7 @@ func main() {
var opts struct {
ConfigFile string `short:"f" long:"config-file" description:"specifying a config file"`
LogLevel string `short:"l" long:"log-level" description:"specifying log level"`
+ LogJson bool `shot:"j" long:"log-json" description:"use json format for logging"`
}
_, err := flags.Parse(&opts)
if err != nil {
@@ -52,7 +53,9 @@ func main() {
log.SetLevel(log.InfoLevel)
}
log.SetOutput(os.Stderr)
- log.SetFormatter(&log.JSONFormatter{})
+ if opts.LogJson {
+ log.SetFormatter(&log.JSONFormatter{})
+ }
if opts.ConfigFile == "" {
opts.ConfigFile = "gobgpd.conf"