Skip to content

Commit

Permalink
Add logging workaround when embedding etcd
Browse files Browse the repository at this point in the history
This was discussed in: etcd-io/etcd#4115
  • Loading branch information
purpleidea committed May 18, 2016
1 parent 6bbce03 commit b876c29
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main

import (
"github.com/codegangsta/cli"
"github.com/coreos/pkg/capnslog"
"log"
"os"
"os/signal"
Expand Down Expand Up @@ -205,10 +206,18 @@ func run(c *cli.Context) error {
}

func main() {
//if DEBUG {
log.SetFlags(log.LstdFlags | log.Lshortfile)
//}
log.SetFlags(log.Flags() - log.Ldate) // remove the date for now
var flags int
if DEBUG || true { // TODO: remove || true
flags = log.LstdFlags | log.Lshortfile
}
flags = (flags - log.Ldate) // remove the date for now
log.SetFlags(flags)

// un-hijack from capnslog...
log.SetOutput(os.Stderr)
capnslog.SetFormatter(capnslog.NewLogFormatter(os.Stderr, "(etcd) ", flags))

// test for sanity
if program == "" || version == "" {
log.Fatal("Program was not compiled correctly. Please see Makefile.")
}
Expand Down

0 comments on commit b876c29

Please sign in to comment.