From 75c32566d10fd8f69b9bf1b72dad0fbd2e0a3746 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Thu, 7 Mar 2019 15:36:59 -0500 Subject: [PATCH] logging: update configuration * Turned stack trace on for Errs * Turned file trace on for all logs * Added error where a panic was detected earlier in the day * Added `run.sh` to ignore --- .gitignore | 1 + connectors/slackapp/slackApp.go | 5 +++++ main.go | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 36bb5e6..29c8840 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ Temporary Items util/*/files util/*/files +run.sh diff --git a/connectors/slackapp/slackApp.go b/connectors/slackapp/slackApp.go index 4a264ed..ad5e24f 100644 --- a/connectors/slackapp/slackApp.go +++ b/connectors/slackapp/slackApp.go @@ -334,6 +334,11 @@ func (s *SlackApp) populateEmojiList() { // I think it's horseshit that I have to do this func slackTStoTime(t string) time.Time { ts := strings.Split(t, ".") + if len(ts) < 2 { + log.Fatal(). + Str("ts", t). + Msg("Could not parse Slack timestamp") + } sec, _ := strconv.ParseInt(ts[0], 10, 64) nsec, _ := strconv.ParseInt(ts[1], 10, 64) return time.Unix(sec, nsec) diff --git a/main.go b/main.go index 521a459..13b0168 100644 --- a/main.go +++ b/main.go @@ -58,8 +58,9 @@ func main() { "Database file to load. (Defaults to catbase.db)") flag.Parse() // parses the logging flags. + log.Logger = log.With().Caller().Stack().Logger() if *prettyLog { - log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) + log.Logger = log.Logger.Output(zerolog.ConsoleWriter{Out: os.Stderr}) } zerolog.SetGlobalLevel(zerolog.InfoLevel) if *debug {