mirror of
https://github.com/ChuckNorrison/LightningTipBot.git
synced 2026-08-13 12:33:14 +02:00
30 lines
559 B
Go
30 lines
559 B
Go
package main
|
|
|
|
import (
|
|
log "github.com/sirupsen/logrus"
|
|
"runtime/debug"
|
|
)
|
|
|
|
// setLogger will initialize the log format
|
|
func setLogger() {
|
|
log.SetLevel(log.InfoLevel)
|
|
customFormatter := new(log.TextFormatter)
|
|
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
|
|
customFormatter.FullTimestamp = true
|
|
log.SetFormatter(customFormatter)
|
|
}
|
|
|
|
func main() {
|
|
// set logger
|
|
setLogger()
|
|
defer withRecovery()
|
|
bot := NewBot()
|
|
bot.Start()
|
|
}
|
|
|
|
func withRecovery() {
|
|
if r := recover(); r != nil {
|
|
log.Errorln("Recovered panic: ", r)
|
|
debug.PrintStack()
|
|
}
|
|
}
|