tawasuyu

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…

⎇ 3171dd59f9faebfd7ddd35d3994e41964ac47973 tandas/staged-fallidos-go-20260705/use-logrus-syslog-hook.patch 43 lines · 1.4 KB History raw

Etapa G (go): triage cola envenenada del VPS — purga 25 (misimports/CGO/embed) + 10 fixes (subdir dolt-atlas-omp, crane ./cmd/crane, trivy GOEXPERIMENT=jsonv2, xq/tea/staticcheck/syft/apko a vía Go auto) 3171dd59f · sergio ·

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()