-
Notifications
You must be signed in to change notification settings - Fork 18
/
main.go
52 lines (43 loc) · 1.23 KB
/
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
package main
import (
"os"
"runtime/debug"
"github.com/coveooss/gotemplate/v3/collections"
_ "github.com/coveooss/gotemplate/v3/hcl"
_ "github.com/coveooss/gotemplate/v3/json"
_ "github.com/coveooss/gotemplate/v3/yaml"
"github.com/coveooss/multilogger"
"github.com/coveooss/multilogger/errors"
)
// Version is initialized at build time through -ldflags "-X main.Version=<version number>"
var version = locallyBuilt
func main() {
// Handle eventual panic message
defer func() {
if err := recover(); err != nil {
if _, isManaged := err.(errors.Managed); String(os.Getenv(envDebug)).ParseBool() || !isManaged {
log.Errorf("%[1]v (%[1]T)", err)
debug.PrintStack()
} else {
log.Error(err)
}
os.Exit(1)
}
}()
os.Exit(NewTGFApplication(os.Args[1:]).Run())
}
func init() {
multilogger.SetGlobalFormat("%module:Italic,Green,Square,IgnoreEmpty,Space%%time% %6globaldelay% %5delta:Round% %-8level:upper,color% %message:color%", false)
log = multilogger.New("tgf").SetStdout(os.Stderr)
awsLogger = NewAwsLogger("tgf.awsSdk")
awsLogger.SetStdout(os.Stderr)
}
type (
// String is imported from collections
String = collections.String
)
var (
must = errors.Must
log *multilogger.Logger
awsLogger *AwsLogger
)