(fix): observer lifecycle
Golang lint / lint (push) Successful in 1m5s

(tests): webhook runtime

(doc): logger options
This commit is contained in:
2026-04-29 13:11:54 +03:00
parent 667fa3cc61
commit 4807dec6ae
8 changed files with 127 additions and 7 deletions
+7 -2
View File
@@ -71,7 +71,9 @@ type BotOpts struct {
// It is zero when the options were not loaded from a versioned file.
FileConfigVersion int
LogFormat utils.LogFormat
// LogFormat selects text or JSON output for bot-managed loggers.
LogFormat utils.LogFormat
// LogFormatter customizes bot-managed logger writers when supported.
LogFormatter *sneklog.Formatter
}
@@ -92,7 +94,7 @@ type BotOpts struct {
// - DROP_RL_OVERFLOW: "true" to drop updates on rate limit overflow
// - STRICT_PAYLOAD_TYPE: "true" to reject callback payloads encoded in a different format
// - MAX_WORKERS: maximum number of concurrent update handlers (default: 32)
// - JSON_LOG:
// - LOG_FORMAT: logger output format, "text" or "json" (default: "text")
//
// Returns a populated BotOpts.
// NewBot validates required fields and returns ErrTokenRequired when TG_TOKEN is missing.
@@ -254,10 +256,13 @@ func (opts *BotOpts) SetMaxWorkers(workers int) *BotOpts {
return opts
}
// SetLogFormat sets the output format used by bot-managed loggers.
func (opts *BotOpts) SetLogFormat(format utils.LogFormat) *BotOpts {
opts.LogFormat = format
return opts
}
// SetLogFormatter sets the formatter used by bot-managed logger writers.
func (opts *BotOpts) SetLogFormatter(formatter *sneklog.Formatter) *BotOpts {
opts.LogFormatter = formatter
return opts