-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
58 lines (46 loc) · 1017 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
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"fmt"
"os"
log "github.com/sirupsen/logrus"
)
var (
// Version of the tool that gets written during build time
Version = "dev"
// CommitHash of the code that get written during build time
CommitHash = ""
)
func main() {
fmt.Printf("Starting DNS-verifier version:%s - commit hash:%s\n", Version, CommitHash)
cfg, err := newConfig()
if err != nil {
fmt.Fprintf(os.Stderr, "error:%v\n", err)
os.Exit(1)
}
initLogging(cfg.logLevel)
app := newApp(cfg.appPort, cfg.watchdogRequests)
app.beforeListen()
if err := app.run(); err != nil {
fmt.Fprintf(os.Stderr, "error:%v\n", err)
os.Exit(1)
}
}
// initLogging initiliazes our logging behaviour
func initLogging(logLevel string) {
var l log.Level
switch logLevel {
case "DEBUG":
l = log.DebugLevel
case "WARNING":
l = log.WarnLevel
case "INFO":
l = log.InfoLevel
case "ERROR":
l = log.ErrorLevel
default:
l = log.InfoLevel
}
log.SetLevel(l)
log.SetOutput(os.Stdout)
log.WithFields(log.Fields{})
}