Navigation Menu

Skip to content

Commit

Permalink
droonga-engine: use Pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 5, 2015
1 parent ad5a90a commit 70f5f95
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/droonga/command/droonga_engine.rb
Expand Up @@ -86,8 +86,8 @@ def run_main_loop
end

def open_log_file
if @configuration.log_file
File.open(@configuration.log_file, "a") do |file|
if @configuration.log_file_path
@configuration.log_file_path.open("a") do |file|
$stdout.reopen(file)
$stderr.reopen(file)
yield
Expand Down Expand Up @@ -156,13 +156,13 @@ def log_level=(level)
ENV["DROONGA_LOG_LEVEL"] = level
end

def log_file
file = @log_file || config["log_file"] || default_log_file
File.expand_path(file)
def log_file_path
path = @log_file_path || config["log_file"] || default_log_file_path
Pathname.new(path).expand_path
end

def log_file=(file)
@log_file = File.expand_path(file)
def log_file_path=(path)
@log_file_path = Pathname.new(path).expand_path
end

def pid_file_path
Expand Down Expand Up @@ -222,7 +222,7 @@ def default_log_level
ENV["DROONGA_LOG_LEVEL"] || Logger::Level.default
end

def default_log_file
def default_log_file_path
Path.default_log_file
end

Expand Down Expand Up @@ -275,8 +275,8 @@ def add_log_options(parser)
self.log_level = level
end
parser.on("--log-file=FILE",
"Output logs to FILE") do |file|
self.log_file = file
"Output logs to FILE") do |path|
self.log_file_path = path
end
end

Expand Down

0 comments on commit 70f5f95

Please sign in to comment.