github.com/ssube/gitlab-ci-multi-runner@v1.2.1-0.20160607142738-b8d1285632e6/executors/executor_trace.go (about) 1 package executors 2 3 import ( 4 "fmt" 5 "github.com/Sirupsen/logrus" 6 "gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers" 7 ) 8 9 func (e *AbstractExecutor) log() *logrus.Entry { 10 if e.Build == nil { 11 return e.Config.Log() 12 } 13 return e.Config.Log().WithField("build", e.Build.ID) 14 } 15 16 func (e *AbstractExecutor) Debugln(args ...interface{}) { 17 e.log().Debugln(args...) 18 } 19 20 func (e *AbstractExecutor) Println(args ...interface{}) { 21 if e.BuildLog != nil { 22 fmt.Fprintln(e.BuildLog, args...) 23 24 if e.BuildLog.IsStdout() { 25 return 26 } 27 } 28 29 if len(args) == 0 { 30 return 31 } 32 33 e.log().Println(args...) 34 } 35 36 func (e *AbstractExecutor) Infoln(args ...interface{}) { 37 if e.BuildLog != nil { 38 fmt.Fprint(e.BuildLog, helpers.ANSI_BOLD_GREEN+fmt.Sprintln(args...)+helpers.ANSI_RESET) 39 40 if e.BuildLog.IsStdout() { 41 return 42 } 43 } 44 45 if len(args) == 0 { 46 return 47 } 48 49 e.log().Println(args...) 50 } 51 52 func (e *AbstractExecutor) Warningln(args ...interface{}) { 53 if e.BuildLog != nil { 54 fmt.Fprint(e.BuildLog, helpers.ANSI_YELLOW+"WARNING: "+fmt.Sprintln(args...)+helpers.ANSI_RESET) 55 56 if e.BuildLog.IsStdout() { 57 return 58 } 59 } 60 61 if len(args) == 0 { 62 return 63 } 64 65 e.log().Warningln(args...) 66 } 67 68 func (e *AbstractExecutor) Errorln(args ...interface{}) { 69 if e.BuildLog != nil { 70 fmt.Fprint(e.BuildLog, helpers.ANSI_BOLD_RED+"ERROR: "+fmt.Sprintln(args...)+helpers.ANSI_RESET) 71 72 if e.BuildLog.IsStdout() { 73 return 74 } 75 } 76 77 e.log().Errorln(args...) 78 }