-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcog.go
45 lines (39 loc) · 905 Bytes
/
cog.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 cog provides the building blocks to build the logging mechanism tailored to the need of your software
package cog
import (
"github.com/thehungry-dev/cog/handler"
"github.com/thehungry-dev/cog/message/transform"
"github.com/thehungry-dev/cog/settings"
)
var DefaultWriter Writer
var TagsWriter Writer
var JSONWriter Writer
func init() {
set := settings.Getenv()
device := set.Device()
DefaultWriter = With(
handler.BuildPipe(
set.LevelFilter(),
set.TagFilter(),
handler.BuildOutput(device, handler.OutputText),
),
)
JSONWriter = With(
handler.BuildPipe(
set.LevelFilter(),
set.TagFilter(),
handler.BuildOutput(device, handler.OutputJSON),
),
)
TagsWriter = With(
handler.BuildPipe(
set.LevelFilter(),
set.TagFilter(),
handler.Output{
Device: device,
Format: handler.OutputText,
Config: transform.EverythingConfig,
},
),
)
}