Skip to content

Commit

Permalink
server configuration class. changed location of log file path.
Browse files Browse the repository at this point in the history
relative log file path -> relative location from base_dir.
absolute log file path -> absolute location from root directory.
  • Loading branch information
y10k committed Aug 21, 2014
1 parent c74aca8 commit cbeed27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rims/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def through_server_params
#
def logging_params
log_file = @config.delete(:log_file) || 'imap.log'
log_file_path = File.join(base_dir, File.basename(log_file))
if (relative_path? log_file) then
log_file_path = File.join(base_dir, log_file)
else
log_file_path = log_file
end

log_level = @config.delete(:log_level) || 'INFO'
log_level = log_level.upcase
Expand Down
12 changes: 12 additions & 0 deletions test/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ def test_logging_params
log_opt_args: []
})

assert_logging_params({ log_file: 'foo/bar/server.log' }, {
log_file: File.join(@base_dir, 'foo/bar/server.log'),
log_level: Logger::INFO,
log_opt_args: []
})

assert_logging_params({ log_file: '/var/rims/server.log' }, {
log_file: '/var/rims/server.log',
log_level: Logger::INFO,
log_opt_args: []
})

assert_logging_params({ log_shift_age: 'daily' }, {
log_file: File.join(@base_dir, 'imap.log'),
log_level: Logger::INFO,
Expand Down

0 comments on commit cbeed27

Please sign in to comment.