feat: add configurable Postal logger level defaulting to INFO (#3626)

This commit is contained in:
pplulee
2026-09-13 13:12:57 +01:00
committed by GitHub
parent 3be663dc89
commit ced77a3860
4 changed files with 17 additions and 0 deletions
+1
View File
@@ -83,6 +83,7 @@ module Postal
def logger
@logger ||= begin
k = Klogger.new(nil, destination: Config.logging.enabled? ? $stdout : "/dev/null", highlight: Config.logging.highlighting_enabled?)
k.level = Config.logging.level
k.add_destination(graylog_logging_destination) if Config.gelf.host.present?
k
end
+13
View File
@@ -227,6 +227,19 @@ module Postal
default true
end
string :level do
description "The minimum log level for the Postal logger (debug, info, warn, error, fatal)"
default "INFO"
transform do |value|
normalized = value.to_s.strip.downcase
normalized = "info" if normalized.empty?
unless %w[debug info warn error fatal].include?(normalized)
raise ArgumentError, "logging.level must be one of: debug, info, warn, error, fatal (got #{value.inspect})"
end
normalized
end
end
boolean :highlighting_enabled do
description "Enable highlighting of log lines"
default false