sergio/takana
> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…
⎇ 0e8d4368121d41a878d5ec676ac7ee177c2f2854
recipes/incoming-go/use-logrus-syslog-hook.patch
Ñawpa willay
ch'uya
Etapa G: pre-siembra cola finde (41 Go vetadas) en incoming-go/ para el worker 24/7
1Replace gitlab-runner/log/system_logger with standard logrus/hooks/syslog.
2There are two reasons:
3
41. gitlab-runner/log/system_logger delegates the syslog initialization
5 (syslog.Dial) to kardianos/service, which doesn't set the syslog
6 facility. This results in messages logged with the "kern" facility.
72. gitlab-runner/log/system_logger maps Error, Panic, and Fatal levels
8 to the syslog's "err" level, but Panic and Fatal could be mapped to
9 the "crit" level.
10
11I didn't contribute this patch to the upstream because I don't wanna
12contribute to any Go projects. However, if you find this patch useful,
13feel free to send it to the upstream under your name.
14
15diff --git a/commands/multi.go b/commands/multi.go
16index e62594be6..a0c2d659b 100644
17--- a/commands/multi.go
18+++ b/commands/multi.go
19@@ -37,6 +37,9 @@ import (
20 "gitlab.com/gitlab-org/gitlab-runner/log"
21 "gitlab.com/gitlab-org/gitlab-runner/network"
22 "gitlab.com/gitlab-org/gitlab-runner/session"
23+
24+ "log/syslog"
25+ lSyslog "github.com/sirupsen/logrus/hooks/syslog"
26 )
27
28 const (
29@@ -1462,7 +1465,13 @@ func (mr *RunCommand) Execute(_ *cli.Context) {
30 }
31
32 if mr.Syslog {
33- log.SetSystemLogger(logrus.StandardLogger(), svc)
34+ hook, err := lSyslog.NewSyslogHook("", "", syslog.LOG_DAEMON | syslog.LOG_INFO, mr.ServiceName)
35+ if err == nil {
36+ logrus.AddHook(hook)
37+ } else {
38+ logrus.WithError(err).
39+ Error("Error while setting up the system logger")
40+ }
41 }
42
43 mr.sentryLogHookMutex.Lock()