-
Notifications
You must be signed in to change notification settings - Fork 29
/
main.go
45 lines (41 loc) · 936 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"github.com/Yuzuki999/Aws-Manger-Bot/conf"
"github.com/Yuzuki999/Aws-Manger-Bot/service/tgbot"
log "github.com/sirupsen/logrus"
easy "github.com/t-tomalak/logrus-easy-formatter"
"os"
)
const (
version = "1.0.4"
)
func printInfo() {
log.Info("Aws Manger Bot")
log.Info("Version: ", version)
log.Info("Github: https://github.com/yuzuki999/Aws-Manger-Bot")
}
func main() {
log.SetFormatter(&easy.Formatter{
TimestampFormat: "01-02 15:04:05",
LogFormat: "Aws-Manger-Bot | %time% | %lvl% >> %msg% \n",
})
printInfo()
config := conf.New()
log.Info("Loading config...")
err := config.LoadConfig()
if err != nil {
log.Error("Load config error: ", err)
os.Exit(1)
}
log.Info("Done")
switch config.LogLevel {
case "info":
log.SetLevel(log.InfoLevel)
case "warn":
log.SetLevel(log.WarnLevel)
case "error":
log.SetLevel(log.ErrorLevel)
}
bot := tgbot.New(config)
bot.Start()
}