-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathowl.go
More file actions
53 lines (43 loc) · 747 Bytes
/
owl.go
File metadata and controls
53 lines (43 loc) · 747 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
43
44
45
46
47
48
49
50
51
52
53
package owl
import (
"errors"
"os"
)
var (
config Configuration
useMetric bool
useSentry bool
useSlack bool
)
func Init(c Configuration) error {
if c.AppName == "" {
return errors.New("owl: `AppName` configuration field cannot be empty")
}
config = c
if os.Getenv("OWL_USE_METRIC") != "" {
useMetric = true
}
if os.Getenv("OWL_USE_SENTRY") != "" {
useSentry = true
}
if os.Getenv("OWL_USE_SLACK") != "" {
useSlack = true
}
if err := initLogger(); err != nil {
return err
}
if err := initMetric(); err != nil {
return err
}
if err := initSlack(); err != nil {
return err
}
return nil
}
func Stop() {
stopLogger()
config = Configuration{}
useMetric = false
useSentry = false
useSlack = false
}