Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKey = "extra"
View Source
var ErrorKeys = []string{"error", "err"}
View Source
var RequestIgnoreHeaders = false
View Source
var RequestKey = "request"
View Source
var SourceKey = "source"
Functions ¶
Types ¶
type ClickHouseHandler ¶
type ClickHouseHandler struct {
// contains filtered or unexported fields
}
type Converter ¶
type Converter func(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, loggerAttr []slog.Attr, groups []string, record *slog.Record) map[string]any
Converter is a function that converts a log record to a map of fields.
type Option ¶
type Option struct {
// Hostname, optional: os.Hostname() will be used if not set
Hostname string
// log level (default: debug)
Level slog.Leveler
// ClickHouse Connection
DB *sql.DB
// ClickHouse Log Table
LogTable string
Timeout time.Duration // default: 60s
// optional: customize clickhouse event builder
Converter Converter
// optional: see slog.HandlerOptions
AddSource bool
ReplaceAttr func(groups []string, a slog.Attr) slog.Attr
}
func (Option) NewClickHouseHandler ¶
Click to show internal directories.
Click to hide internal directories.

