aboutsummaryrefslogtreecommitdiffstats
path: root/logger/log.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-23 04:43:58 +0800
committerobscuren <geffobscura@gmail.com>2015-03-23 04:43:58 +0800
commit59eab49cb849ca93b9608763f4842654e8044d0f (patch)
tree8a04499cb63dd8d91fd136f65c29605844c5bae8 /logger/log.go
parent8ed4f226d1dbecc9625a2f142e22926569198b73 (diff)
parent8b1b9fc99d63a19c216edebc07096718e835937d (diff)
downloaddexon-59eab49cb849ca93b9608763f4842654e8044d0f.tar
dexon-59eab49cb849ca93b9608763f4842654e8044d0f.tar.gz
dexon-59eab49cb849ca93b9608763f4842654e8044d0f.tar.bz2
dexon-59eab49cb849ca93b9608763f4842654e8044d0f.tar.lz
dexon-59eab49cb849ca93b9608763f4842654e8044d0f.tar.xz
dexon-59eab49cb849ca93b9608763f4842654e8044d0f.tar.zst
dexon-59eab49cb849ca93b9608763f4842654e8044d0f.zip
Merge branch 'ethersphere-jsonlog' into develop
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