Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
siddontang committed Aug 18, 2014
2 parents 158e65c + a4d3cf7 commit 84b3ff5
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cmd/mixer-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package main

import (
"flag"
"strings"
"github.com/siddontang/go-log/log"
"github.com/siddontang/mixer/config"
"github.com/siddontang/mixer/proxy"
"github.com/siddontang/go-log/log"
"os"
"os/signal"
"runtime"
"strings"
"syscall"
)

var configFile = flag.String("config", "/etc/mixer.conf", "mixer proxy config file")
var logLevel *string = flag.String("l", "[debug|info|warn|error]", "log level")
var logLevel *string = flag.String("log-level", "", "log level [debug|info|warn|error], default error")

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
Expand All @@ -30,13 +30,13 @@ func main() {
println(err.Error())
return
}

if *logLevel != "" {
setLogLevel(*logLevel)
} else {
setLogLevel(cfg.LogLevel)
}

var svr *proxy.Server
svr, err = proxy.NewServer(cfg)
if err != nil {
Expand All @@ -60,12 +60,16 @@ func main() {
svr.Run()
}

func setLogLevel(level string){
func setLogLevel(level string) {
switch strings.ToLower(level) {
case "debug":log.SetLevel(log.LevelDebug)
case "info":log.SetLevel(log.LevelInfo)
case "warn":log.SetLevel(log.LevelWarn)
case "error":log.SetLevel(log.LevelError)
case "debug":
log.SetLevel(log.LevelDebug)
case "info":
log.SetLevel(log.LevelInfo)
case "warn":
log.SetLevel(log.LevelWarn)
case "error":
log.SetLevel(log.LevelError)
default:
log.SetLevel(log.LevelError)
}
Expand Down

0 comments on commit 84b3ff5

Please sign in to comment.