From a77084b12e315322deab25c5ddfafad6d13c3aed Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 20 Sep 2018 01:47:24 +0300 Subject: [PATCH] Fix log file name format and remove old debug prints --- .gitignore | 2 ++ app/bot.go | 3 --- config/logging.go | 2 +- database/clients.go | 1 - database/commands.go | 1 - example-config.yaml | 4 ++-- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 4abb511..5c0bbe0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ *.yaml !example-config.yaml +logs/ + plugins/ # Bots under maubot.xyz diff --git a/app/bot.go b/app/bot.go index 0315777..8851d1b 100644 --- a/app/bot.go +++ b/app/bot.go @@ -51,21 +51,18 @@ func (bot *Bot) Init() { bot.initServer() bot.loadPlugins() bot.createPlugins() - log.Debugln("Init func exit") } func (bot *Bot) Start() { go bot.startClients() go bot.startServer() bot.startPlugins() - log.Debugln("Start func exit") } func (bot *Bot) Stop() { bot.stopPlugins() bot.stopServer() bot.stopClients() - log.Debugln("Stop func exit") } func (bot *Bot) initDatabase() { diff --git a/config/logging.go b/config/logging.go index 8a8da36..06e441b 100644 --- a/config/logging.go +++ b/config/logging.go @@ -82,7 +82,7 @@ func (lc *LogConfig) MarshalYAML() (interface{}, error) { func CreateLogConfig() LogConfig { return LogConfig{ Directory: "./logs", - FileNameFormat: "%[1]s-%02[2]d.log", + FileNameFormat: "{{.Date}}-{{.Index}}.log", TimestampFormat: "Jan _2, 2006 15:04:05", FileMode: 0600, FileDateFormat: "2006-01-02", diff --git a/database/clients.go b/database/clients.go index 1717ba2..0068a54 100644 --- a/database/clients.go +++ b/database/clients.go @@ -122,7 +122,6 @@ func (mxc *MatrixClient) LoadCommandSpecs() *MatrixClient { for _, spec := range specs { mxc.CommandSpecs[spec.Owner] = spec } - log.Debugln("Loaded command specs:", mxc.CommandSpecs) return mxc } diff --git a/database/commands.go b/database/commands.go index 0425a47..08cc8ab 100644 --- a/database/commands.go +++ b/database/commands.go @@ -82,7 +82,6 @@ func (css *CommandSpecStatic) getAllByQuery(query string, args ...interface{}) ( for rows.Next() { specs = append(specs, css.New().Scan(rows)) } - log.Debugln("getAllByQuery() =", specs) return } diff --git a/example-config.yaml b/example-config.yaml index e51d6c9..23e294e 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -5,8 +5,8 @@ database: logging: directory: ./logs file_mode: 0600 - print_debug: false - file_name_format: "%[1]s-%02[2]d.log" + print_level: DEBUG + file_name_format: "{{.Date}}-{{.Index}}.log" file_date_format: 2006-01-02 timestamp_format: Jan _2, 2006 15:04:05