mirror of https://github.com/velour/catbase.git
Merge pull request #159 from velour/logging
logging: update configuration
This commit is contained in:
commit
578722cd19
|
@ -67,3 +67,4 @@ Temporary Items
|
||||||
|
|
||||||
util/*/files
|
util/*/files
|
||||||
util/*/files
|
util/*/files
|
||||||
|
run.sh
|
||||||
|
|
|
@ -334,6 +334,11 @@ func (s *SlackApp) populateEmojiList() {
|
||||||
// I think it's horseshit that I have to do this
|
// I think it's horseshit that I have to do this
|
||||||
func slackTStoTime(t string) time.Time {
|
func slackTStoTime(t string) time.Time {
|
||||||
ts := strings.Split(t, ".")
|
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)
|
sec, _ := strconv.ParseInt(ts[0], 10, 64)
|
||||||
nsec, _ := strconv.ParseInt(ts[1], 10, 64)
|
nsec, _ := strconv.ParseInt(ts[1], 10, 64)
|
||||||
return time.Unix(sec, nsec)
|
return time.Unix(sec, nsec)
|
||||||
|
|
3
main.go
3
main.go
|
@ -58,8 +58,9 @@ func main() {
|
||||||
"Database file to load. (Defaults to catbase.db)")
|
"Database file to load. (Defaults to catbase.db)")
|
||||||
flag.Parse() // parses the logging flags.
|
flag.Parse() // parses the logging flags.
|
||||||
|
|
||||||
|
log.Logger = log.With().Caller().Stack().Logger()
|
||||||
if *prettyLog {
|
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)
|
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||||
if *debug {
|
if *debug {
|
||||||
|
|
Loading…
Reference in New Issue