مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
add a configurable log root
هذا الالتزام موجود في:
@@ -37,6 +37,7 @@ main_db:
|
||||
|
||||
logging:
|
||||
stdout: false
|
||||
root: # Automatically determined based on config root
|
||||
max_log_file_size: 20
|
||||
max_log_files: 10
|
||||
|
||||
|
||||
@@ -43,6 +43,18 @@ module Postal
|
||||
end
|
||||
end
|
||||
|
||||
def self.log_root
|
||||
@log_root ||= begin
|
||||
if config.logging.root
|
||||
Pathname.new(config.logging.root)
|
||||
elsif __FILE__ =~ /\/opt\/postal/
|
||||
Pathname.new("/opt/postal/log")
|
||||
else
|
||||
app_root.join('log')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.config_file_path
|
||||
@config_file_path ||= File.join(config_root, 'postal.yml')
|
||||
end
|
||||
@@ -74,7 +86,7 @@ module Postal
|
||||
if config.logging.stdout || ENV['LOG_TO_STDOUT']
|
||||
Postal::AppLogger.new(name, STDOUT)
|
||||
else
|
||||
Postal::AppLogger.new(name, app_root.join('log', "#{name}.log"), config.logging.max_log_files || 10, (config.logging.max_log_file_size || 20).megabytes)
|
||||
Postal::AppLogger.new(name, log_root.join("#{name}.log"), config.logging.max_log_files, config.logging.max_log_file_size.megabytes)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم