Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Acosta committed Feb 5, 2016
1 parent 8b8a332 commit 5ec4e53
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ while true; do
APP_ARGS="$APP_ARGS -$ARG_NAME=$ARG_VALUE"
;;
--debug)
APP_ARGS="$APP_ARGS -log-level=debug"
PROBE_ARGS="$PROBE_ARGS -log-level=debug"
APP_ARGS="$APP_ARGS -log.level=debug"
PROBE_ARGS="$PROBE_ARGS -log.level=debug"
;;
--no-app)
touch /etc/service/app/down
Expand Down
7 changes: 1 addition & 6 deletions prog/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/http"
_ "net/http/pprof"
"strconv"
"strings"
"time"

log "github.com/Sirupsen/logrus"
Expand All @@ -32,16 +31,12 @@ func appMain() {
var (
window = flag.Duration("window", 15*time.Second, "window")
listen = flag.String("http.address", ":"+strconv.Itoa(xfer.AppPort), "webserver listen address")
logLevel = flag.String("log-level", "info", "logging threshold level: debug|info|warn|error|fatal|panic")
logLevel = flag.String("log.level", "info", "logging threshold level: debug|info|warn|error|fatal|panic")
logPrefix = flag.String("log.prefix", "<app>", "prefix for each log line")
)
flag.Parse()

setLogLevel(*logLevel)

if !strings.HasSuffix(*logPrefix, " ") {
*logPrefix += " "
}
setLogFormatter(*logPrefix)

defer log.Info("app exiting")
Expand Down
4 changes: 4 additions & 0 deletions prog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strings"

log "github.com/Sirupsen/logrus"
weavecommon "github.com/weaveworks/weave/common"
Expand All @@ -24,6 +25,9 @@ func (f *prefixFormatter) Format(entry *log.Entry) ([]byte, error) {
}

func setLogFormatter(prefix string) {
if !strings.HasSuffix(prefix, " ") {
prefix += " "
}
f := prefixFormatter{
prefix: []byte(prefix),
// reuse weave's log format
Expand Down
6 changes: 1 addition & 5 deletions prog/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,11 @@ func probeMain() {
useConntrack = flag.Bool("conntrack", true, "also use conntrack to track connections")
insecure = flag.Bool("insecure", false, "(SSL) explicitly allow \"insecure\" SSL connections and transfers")
logPrefix = flag.String("log.prefix", "<probe>", "prefix for each log line")
logLevel = flag.String("log-level", "info", "logging threshold level: debug|info|warn|error|fatal|panic")
logLevel = flag.String("log.level", "info", "logging threshold level: debug|info|warn|error|fatal|panic")
)
flag.Parse()

setLogLevel(*logLevel)

if !strings.HasSuffix(*logPrefix, " ") {
*logPrefix += " "
}
setLogFormatter(*logPrefix)

// Setup in memory metrics sink
Expand Down

0 comments on commit 5ec4e53

Please sign in to comment.