[TASK] add debugging
This commit is contained in:
parent
65047a6c8b
commit
73c4a38940
|
@ -47,6 +47,9 @@ var serverCmd = &cobra.Command{
|
|||
if config == nil || err != nil {
|
||||
log.Panicf("Could not load '%s' for configuration.", configPath)
|
||||
}
|
||||
if config.Debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
}
|
||||
|
||||
db = database.ReadDBFile(config.DB)
|
||||
go func() { dbSaveWorker = file.NewSaveJSONWorker(time.Minute, config.DB, db) }()
|
||||
|
@ -124,6 +127,11 @@ func reload() {
|
|||
log.Errorf("reload: could not load '%s' for new configuration. Skip reload.", configPath)
|
||||
return
|
||||
}
|
||||
if config.Debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
} else {
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
in.Close()
|
||||
in = allInput.Init(config.Input, logChannel)
|
||||
go in.Listen()
|
||||
|
|
|
@ -3,6 +3,7 @@ package lib
|
|||
// Struct of the configuration
|
||||
// e.g. under dev.sum7.eu/genofire/logmania/logmania_example.conf
|
||||
type Config struct {
|
||||
Debug bool `toml:"debug"`
|
||||
DB string `toml:"database"`
|
||||
HTTPAddress string `toml:"http_address"`
|
||||
Webroot string `toml:"webroot"`
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
debug = false
|
||||
database = "/tmp/logmania.state.json"
|
||||
|
||||
# have to be mote then a minute
|
||||
|
|
Loading…
Reference in New Issue