Initial go port of epics

This commit is contained in:
Martino Ferrari
2026-04-28 00:09:22 +02:00
parent 47e481a461
commit 6e51ffc5e1
28 changed files with 5634 additions and 178 deletions
+26
View File
@@ -0,0 +1,26 @@
package ca
import (
"log/slog"
"os"
)
// calog is the package-level debug logger.
// It is active only when the environment variable UOPI_CA_DEBUG is set to a
// non-empty value at program startup. All output goes to stderr.
var calog *slog.Logger
func init() {
if os.Getenv("UOPI_CA_DEBUG") != "" {
calog = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelDebug,
}))
}
}
// dbg emits a DEBUG log if UOPI_CA_DEBUG is set. It is a no-op otherwise.
func dbg(msg string, args ...any) {
if calog != nil {
calog.Debug(msg, args...)
}
}