-
Notifications
You must be signed in to change notification settings - Fork 251
/
stdio.go
40 lines (29 loc) · 859 Bytes
/
stdio.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
package stdio
import (
"log"
"os"
"github.com/taskcluster/taskcluster/v37/tools/worker-runner/cfg"
"github.com/taskcluster/taskcluster/v37/tools/worker-runner/logging/logging"
)
type stdioLogDestination struct {
log *log.Logger
}
func (dst *stdioLogDestination) LogUnstructured(message string) {
dst.log.Println(message)
}
func (dst *stdioLogDestination) LogStructured(message map[string]interface{}) {
dst.log.Println(logging.ToUnstructured(message))
}
func New(runnercfg *cfg.RunnerConfig) logging.Logger {
return &stdioLogDestination{log: log.New(os.Stderr, "", log.LstdFlags)}
}
func Usage() string {
return `
The "stdio" logging logs to stderr with a timestamp prefix. It is the default
if no logging configuration is given. It does not take any other properties.
` + "```yaml" + `
logging:
implementation: stdio
` + "```" + `
`
}