mirror of
https://github.com/postalserver/postal.git
synced 2026-10-18 18:26:06 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d032f3943c |
+3
-3
@@ -196,7 +196,7 @@ GEM
|
|||||||
loofah (2.25.1)
|
loofah (2.25.1)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.12.0)
|
nokogiri (>= 1.12.0)
|
||||||
mail (2.9.0)
|
mail (2.9.1)
|
||||||
logger
|
logger
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
net-imap
|
net-imap
|
||||||
@@ -211,12 +211,12 @@ GEM
|
|||||||
mysql2 (0.5.6)
|
mysql2 (0.5.6)
|
||||||
net-http (0.4.1)
|
net-http (0.4.1)
|
||||||
uri
|
uri
|
||||||
net-imap (0.6.4)
|
net-imap (0.6.6)
|
||||||
date
|
date
|
||||||
net-protocol
|
net-protocol
|
||||||
net-pop (0.1.2)
|
net-pop (0.1.2)
|
||||||
net-protocol
|
net-protocol
|
||||||
net-protocol (0.2.2)
|
net-protocol (0.3.0)
|
||||||
timeout
|
timeout
|
||||||
net-smtp (0.5.1)
|
net-smtp (0.5.1)
|
||||||
net-protocol
|
net-protocol
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ This document contains all the environment variables which are available for thi
|
|||||||
| `LOGGING_RAILS_LOG_ENABLED` | Boolean | Enable the default Rails logger | false |
|
| `LOGGING_RAILS_LOG_ENABLED` | Boolean | Enable the default Rails logger | false |
|
||||||
| `LOGGING_SENTRY_DSN` | String | A DSN which should be used to report exceptions to Sentry | |
|
| `LOGGING_SENTRY_DSN` | String | A DSN which should be used to report exceptions to Sentry | |
|
||||||
| `LOGGING_ENABLED` | Boolean | Enable the Postal logger to log to STDOUT | true |
|
| `LOGGING_ENABLED` | Boolean | Enable the Postal logger to log to STDOUT | true |
|
||||||
| `LOGGING_LEVEL` | String | The minimum log level for the Postal logger (debug, info, warn, error, fatal) | INFO |
|
|
||||||
| `LOGGING_HIGHLIGHTING_ENABLED` | Boolean | Enable highlighting of log lines | false |
|
| `LOGGING_HIGHLIGHTING_ENABLED` | Boolean | Enable highlighting of log lines | false |
|
||||||
| `GELF_HOST` | String | GELF-capable host to send logs to | |
|
| `GELF_HOST` | String | GELF-capable host to send logs to | |
|
||||||
| `GELF_PORT` | Integer | GELF port to send logs to | 12201 |
|
| `GELF_PORT` | Integer | GELF port to send logs to | 12201 |
|
||||||
|
|||||||
@@ -89,8 +89,6 @@ logging:
|
|||||||
sentry_dsn:
|
sentry_dsn:
|
||||||
# Enable the Postal logger to log to STDOUT
|
# Enable the Postal logger to log to STDOUT
|
||||||
enabled: true
|
enabled: true
|
||||||
# The minimum log level for the Postal logger (debug, info, warn, error, fatal)
|
|
||||||
level: INFO
|
|
||||||
# Enable highlighting of log lines
|
# Enable highlighting of log lines
|
||||||
highlighting_enabled: false
|
highlighting_enabled: false
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ require "konfig/sources/environment"
|
|||||||
require "konfig/sources/yaml"
|
require "konfig/sources/yaml"
|
||||||
require "dotenv"
|
require "dotenv"
|
||||||
require "klogger"
|
require "klogger"
|
||||||
require "securerandom"
|
|
||||||
|
|
||||||
require_relative "error"
|
require_relative "error"
|
||||||
require_relative "config_schema"
|
require_relative "config_schema"
|
||||||
@@ -83,21 +82,16 @@ module Postal
|
|||||||
def logger
|
def logger
|
||||||
@logger ||= begin
|
@logger ||= begin
|
||||||
k = Klogger.new(nil, destination: Config.logging.enabled? ? $stdout : "/dev/null", highlight: Config.logging.highlighting_enabled?)
|
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.add_destination(graylog_logging_destination) if Config.gelf.host.present?
|
||||||
k
|
k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_identity
|
|
||||||
@process_identity ||= SecureRandom.hex(8)
|
|
||||||
end
|
|
||||||
|
|
||||||
def process_name
|
def process_name
|
||||||
@process_name ||= begin
|
@process_name ||= begin
|
||||||
"host:#{Socket.gethostname} pid:#{Process.pid} id:#{process_identity}"
|
"host:#{Socket.gethostname} pid:#{Process.pid}"
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
"pid:#{Process.pid} id:#{process_identity}"
|
"pid:#{Process.pid}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -227,19 +227,6 @@ module Postal
|
|||||||
default true
|
default true
|
||||||
end
|
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
|
boolean :highlighting_enabled do
|
||||||
description "Enable highlighting of log lines"
|
description "Enable highlighting of log lines"
|
||||||
default false
|
default false
|
||||||
|
|||||||
Reference in New Issue
Block a user