-
Notifications
You must be signed in to change notification settings - Fork 0
/
executor_trace.go
78 lines (60 loc) · 1.4 KB
/
executor_trace.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package executors
import (
"fmt"
"github.com/Sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers"
)
func (e *AbstractExecutor) log() *logrus.Entry {
if e.Build == nil {
return e.Config.Log()
}
return e.Config.Log().WithField("build", e.Build.ID)
}
func (e *AbstractExecutor) Debugln(args ...interface{}) {
e.log().Debugln(args...)
}
func (e *AbstractExecutor) Println(args ...interface{}) {
if e.BuildLog != nil {
fmt.Fprintln(e.BuildLog, args...)
if e.BuildLog.IsStdout() {
return
}
}
if len(args) == 0 {
return
}
e.log().Println(args...)
}
func (e *AbstractExecutor) Infoln(args ...interface{}) {
if e.BuildLog != nil {
fmt.Fprint(e.BuildLog, helpers.ANSI_BOLD_GREEN+fmt.Sprintln(args...)+helpers.ANSI_RESET)
if e.BuildLog.IsStdout() {
return
}
}
if len(args) == 0 {
return
}
e.log().Println(args...)
}
func (e *AbstractExecutor) Warningln(args ...interface{}) {
if e.BuildLog != nil {
fmt.Fprint(e.BuildLog, helpers.ANSI_YELLOW+"WARNING: "+fmt.Sprintln(args...)+helpers.ANSI_RESET)
if e.BuildLog.IsStdout() {
return
}
}
if len(args) == 0 {
return
}
e.log().Warningln(args...)
}
func (e *AbstractExecutor) Errorln(args ...interface{}) {
if e.BuildLog != nil {
fmt.Fprint(e.BuildLog, helpers.ANSI_BOLD_RED+"ERROR: "+fmt.Sprintln(args...)+helpers.ANSI_RESET)
if e.BuildLog.IsStdout() {
return
}
}
e.log().Errorln(args...)
}