From e1952a52e4b69b486f1899d8adbd68cec3ec68e9 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Mon, 14 Sep 2015 22:20:27 +0200 Subject: [PATCH] flag for log level --- release/server/main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/server/main.go b/release/server/main.go index 2ee5365d..66098e0e 100644 --- a/release/server/main.go +++ b/release/server/main.go @@ -16,12 +16,22 @@ import ( var ( configFile = flag.String("config", "", "Config file for this Point server.") + logLevel = flag.String("loglevel", "", "Level of log info to be printed to console, available value: debug, info, warning, error") ) func main() { flag.Parse() - - log.SetLogLevel(log.DebugLevel) + + switch *logLevel { + case "debug": + log.SetLogLevel(log.DebugLevel) + case "info": + log.SetLogLevel(log.InfoLevel) + case "warning": + log.SetLogLevel(log.WarningLevel) + case "error": + log.SetLogLevel(log.ErrorLevel) + } if configFile == nil || len(*configFile) == 0 { panic(log.Error("Config file is not set."))