aboutsummaryrefslogtreecommitdiffstats
path: root/logger/log.go
diff options
context:
space:
mode:
Diffstat (limited to 'logger/log.go')
-rw-r--r--logger/log.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/logger/log.go b/logger/log.go
index fab004d0a..e2a35ba53 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, logFormat string) LogSystem {
+func New(datadir string, logFile string, logLevel int) LogSystem {
var writer io.Writer
if logFile == "" {
writer = os.Stdout
@@ -27,14 +27,22 @@ func New(datadir string, logFile string, logLevel int, logFormat string) LogSyst
}
var sys LogSystem
- switch logFormat {
- case "raw":
- sys = NewRawLogSystem(writer, 0, LogLevel(logLevel))
- case "json":
- sys = NewJsonLogSystem(writer, 0, LogLevel(logLevel))
- default:
- sys = NewStdLogSystem(writer, log.LstdFlags, LogLevel(logLevel))
+ sys = NewStdLogSystem(writer, log.LstdFlags, LogLevel(logLevel))
+ AddLogSystem(sys)
+
+ return sys
+}
+
+func NewJSONsystem(datadir string, logFile string) LogSystem {
+ var writer io.Writer
+ if logFile == "-" {
+ writer = os.Stdout
+ } else {
+ writer = openLogFile(datadir, logFile)
}
+
+ var sys LogSystem
+ sys = NewJsonLogSystem(writer)
AddLogSystem(sys)
return sys