Initial commit: email-openclaw bridge v1
Full pipeline: IMAP ingress -> OpenClaw dispatch -> callback -> SMTP reply. SQLite stateful storage with idempotency, threading, and retry logic. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Setup initialises the application-wide structured logger.
|
||||
// All output goes to stdout as JSON for easy parsing by Docker / log aggregators.
|
||||
func Setup() {
|
||||
handler := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
|
||||
Level: slog.LevelInfo,
|
||||
})
|
||||
slog.SetDefault(slog.New(handler))
|
||||
}
|
||||
|
||||
// TaskLogger returns a logger pre-populated with common task fields.
|
||||
// Usage: logging.TaskLogger(taskUUID, threadID, messageID).Info("message", ...)
|
||||
func TaskLogger(taskUUID, threadID, messageID string) *slog.Logger {
|
||||
return slog.With(
|
||||
"task_uuid", taskUUID,
|
||||
"thread_id", threadID,
|
||||
"message_id", messageID,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user