aboutsummaryrefslogtreecommitdiffstats
path: root/logger/log.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-01-22 00:17:07 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-01-22 00:17:07 +0800
commitbdf99e098126880c10dc2ef68623c47ec6f04537 (patch)
treec7264b48d8012701911753565c0a11aea069bbb2 /logger/log.go
parentacdc19d1b7b25d6ebd8457f423659f3d112a4a75 (diff)
downloadgo-tangerine-bdf99e098126880c10dc2ef68623c47ec6f04537.tar.gz
go-tangerine-bdf99e098126880c10dc2ef68623c47ec6f04537.tar.zst
go-tangerine-bdf99e098126880c10dc2ef68623c47ec6f04537.zip
Add LogFormat flag
Diffstat (limited to 'logger/log.go')
-rw-r--r--logger/log.go10
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