1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 17:42:48 +00:00

switched to gin - use logrus

This commit is contained in:
2018-02-06 18:54:13 +00:00
parent 74976de6cf
commit 5b6d74149d
12 changed files with 116 additions and 212 deletions

25
main.go
View File

@@ -1,16 +1,39 @@
package main
import (
"github.com/gin-gonic/gin"
"github.com/mgerb/go-discord-bot/server/bot"
"github.com/mgerb/go-discord-bot/server/bothandlers"
"github.com/mgerb/go-discord-bot/server/config"
"github.com/mgerb/go-discord-bot/server/webserver"
log "github.com/sirupsen/logrus"
"os"
)
func main() {
func init() {
//read config file
config.Init()
// Log as JSON instead of the default ASCII formatter.
log.SetFormatter(&log.JSONFormatter{})
// Output to stdout instead of the default stderr
// Can be any io.Writer, see below for File example
log.SetOutput(os.Stdout)
if config.Flags.Prod {
// prod
gin.SetMode(gin.ReleaseMode)
// Only log the warning severity or above.
log.SetLevel(log.WarnLevel)
} else {
// debug
log.SetLevel(log.DebugLevel)
}
}
func main() {
//connect bot to account with token
bot.Connect(config.Config.Token)