diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-22 00:17:07 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-22 00:17:07 +0800 |
commit | bdf99e098126880c10dc2ef68623c47ec6f04537 (patch) | |
tree | c7264b48d8012701911753565c0a11aea069bbb2 /logger | |
parent | acdc19d1b7b25d6ebd8457f423659f3d112a4a75 (diff) | |
download | dexon-bdf99e098126880c10dc2ef68623c47ec6f04537.tar.gz dexon-bdf99e098126880c10dc2ef68623c47ec6f04537.tar.zst dexon-bdf99e098126880c10dc2ef68623c47ec6f04537.zip |
Add LogFormat flag
Diffstat (limited to 'logger')
-rw-r--r-- | logger/log.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/logger/log.go b/logger/log.go index 53065f870..baa3dfaf2 100644 --- a/logger/log.go +++ b/logger/log.go @@ -18,7 +18,7 @@ func openLogFile(datadir string, filename string) *os.File { return file } -func New(datadir string, logFile string, logLevel int) LogSystem { +func New(datadir string, logFile string, logLevel int, logFormat string) LogSystem { var writer io.Writer if logFile == "" { writer = os.Stdout @@ -26,7 +26,13 @@ func New(datadir string, logFile string, logLevel int) LogSystem { writer = openLogFile(datadir, logFile) } - sys := NewStdLogSystem(writer, log.LstdFlags, LogLevel(logLevel)) + var sys LogSystem + switch logFormat { + case "raw": + sys = NewRawLogSystem(writer, 0, LogLevel(logLevel)) + default: + sys = NewStdLogSystem(writer, log.LstdFlags, LogLevel(logLevel)) + } AddLogSystem(sys) return sys |