From 2436872e8e7948eb3a094099995928afa875b2d0 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Thu, 29 Oct 2020 22:14:36 -0400 Subject: [PATCH] Pushed loggy options to config.json --- config.json.sample | 12 ++++++++++-- main.go | 22 ++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/config.json.sample b/config.json.sample index acaec3f..0197ba2 100644 --- a/config.json.sample +++ b/config.json.sample @@ -9,9 +9,17 @@ "BumpTime": "", "LastBumper": "", "Stats": { - "374988675546873886": 80 }, "Unverified": {}, "Verifications": {}, - "Probations": {} + "Probations": { + }, + "LogOpts": { + "OutFile": "", + "KBTeam": "", + "KBChann": "", + "Level": 5, + "ProgName": "disgord-thanos", + "UseStdout": true + } } \ No newline at end of file diff --git a/main.go b/main.go index 7c3a488..9bb260f 100644 --- a/main.go +++ b/main.go @@ -18,20 +18,12 @@ import ( ) var ( - // Logging Setup - logOpts = loggy.LogOpts{ - UseStdout: true, - Level: 5, - KBTeam: "nightmarehaus.logs.fetiche", - KBChann: "general", - ProgName: "disgord-thanos", - } - log = loggy.NewLogger(logOpts) startupTime time.Time setupToken = fmt.Sprintf("!setup %+v", rand.Intn(9999)+1000) rebootToken = fmt.Sprintf("!reboot %+v", rand.Intn(9999)+1000) bump = true config Config + log = loggy.NewLogger(config.LogOpts) lastActiveChan string lastActiveTime time.Time token string @@ -49,17 +41,19 @@ func init() { func main() { defer log.PanicSafe() + if configFile == "" { + configFile = "config.json" + } else { + loadConfig() + } + log = loggy.NewLogger(config.LogOpts) startupTime = time.Now() lastActiveTime = time.Now() lastActiveChan = config.AdminChannel if token == "" { log.LogPanic("No token provided. Please run: disgord-thanos -t ") } - if configFile == "" { - configFile = "config.json" - } else { - loadConfig() - } + log.LogCritical(fmt.Sprintf("SetupToken: %+v\nRebootToken: %+v", setupToken, rebootToken)) dg, err := discordgo.New("Bot " + token) if err != nil {