go-seqlogger is a custom log handler for sending structured logs to Seq using Go's slog package.
go get github.com/swczk/go-seqloggerimport (
"log/slog"
"github.com/swczk/go-seqlogger"
)
// Create default configuration
config := seqlogger.DefaultConfig("http://seq-example:5341").
WithAPIKey("your-api-key").
WithLogLevel(slog.LevelInfo).
WithSourceTracking().
WithRequestIDKey("request-id")
// Create logger
logger := seqlogger.New(config)
// Log messages
logger.Info("User logged in", "user_id", 123)
logger.Error("Failed to process request", "error", err)
// Logging with JSON data
logger.Info("User registration",
"user", `{"id": 123, "name": "John Doe", "details": {"age": 30, "city": "New York"}}`,
"registration_source", "web"
)Endpoint: Seq server URLAPIKey: Authentication key for SeqLogLevel: Minimum log level to sendAddSource: Include source code locationRequestIDKey: Context key for request tracing
- Structured logging
- Seq CLEF format compatibility
- Configurable log levels
- Source code tracking
- Request ID injection
MIT License