-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
42 lines (33 loc) · 870 Bytes
/
main.go
File metadata and controls
42 lines (33 loc) · 870 Bytes
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
package main
import (
"github.com/ShaleApps/go-service-utils/helpers"
"github.com/ShaleApps/{{SERVICE_NAME}}/app"
"github.com/ShaleApps/{{SERVICE_NAME}}/internal/config"
"github.com/sirupsen/logrus"
"strings"
)
var Version = "0.1.0"
func init() {
// Configure logger
logLevel, err := logrus.ParseLevel(strings.ToLower(helpers.GetEnv("LOG_LEVEL", "INFO")))
if err != nil {
panic(err)
}
logrus.SetLevel(logLevel)
fieldMap := logrus.FieldMap{
logrus.FieldKeyTime: "@log_timestamp",
logrus.FieldKeyLevel: "@severity",
logrus.FieldKeyMsg: "@message",
logrus.FieldKeyFunc: "@caller",
}
var formatter = &logrus.JSONFormatter{
FieldMap: fieldMap,
}
logrus.SetFormatter(formatter)
logrus.SetReportCaller(true)
}
func main() {
logrus.Infof("Starting {{SERVICE_NAME}} server v%s", Version)
cnf := config.LoadConfig()
app.StartApp(cnf)
}