Mining/pkg/mining/syslog_unix.go
Claude 140f038f37
Some checks failed
Release / Release (push) Blocked by required conditions
Desktop Release / Build darwin (push) Waiting to run
Desktop Release / Build windows (push) Waiting to run
Desktop Release / Create Release (push) Blocked by required conditions
E2E Tests / E2E Tests (push) Failing after 1m23s
Tests / Go Tests (push) Failing after 39s
Desktop Release / Build linux (push) Failing after 46s
Release / Test (push) Failing after 2s
Tests / C++ Tests (push) Failing after 1m12s
chore: migrate module path from github.com to forge.lthn.ai
Move module declaration and all internal imports from
github.com/Snider/Mining to forge.lthn.ai/Snider/Mining. Also updates
Borg, Enchantrix, and Poindexter dependency paths to forge.lthn.ai.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:39:01 +00:00

33 lines
846 B
Go

//go:build !windows
package mining
import (
"log/syslog"
"forge.lthn.ai/Snider/Mining/pkg/logging"
)
var syslogWriter *syslog.Writer
func init() {
// Initialize syslog writer globally.
// LOG_NOTICE is for normal but significant condition.
// LOG_DAEMON is for system daemons.
// "mining-service" is the tag for the log messages.
var err error
syslogWriter, err = syslog.New(syslog.LOG_NOTICE|syslog.LOG_DAEMON, "mining-service")
if err != nil {
logging.Warn("failed to connect to syslog, syslog logging disabled", logging.Fields{"error": err})
syslogWriter = nil // Ensure it's nil on failure
}
}
// logToSyslog sends a message to syslog if available, otherwise falls back to standard log.
func logToSyslog(message string) {
if syslogWriter != nil {
_ = syslogWriter.Notice(message)
} else {
logging.Info(message)
}
}