Navigation Menu

Skip to content

Commit

Permalink
droonga-engine: don't change log level env in Configuration
Browse files Browse the repository at this point in the history
It's not the work of Configuration.
  • Loading branch information
kou committed Jan 5, 2015
1 parent 11b7e67 commit c97f2fa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/droonga/command/droonga_engine.rb
Expand Up @@ -48,6 +48,7 @@ def run(command_line_arguments)
parse_command_line_arguments!(command_line_arguments)

setup_path
setup_log

if @configuration.daemon?
Process.daemon
Expand Down Expand Up @@ -80,6 +81,10 @@ def setup_path
end
end

def setup_log
ENV["DROONGA_LOG_LEVEL"] = @configuration.log_level
end

def run_main_loop
main_loop = MainLoop.new(@configuration)
main_loop.run
Expand Down Expand Up @@ -121,6 +126,7 @@ def initialize
@port = nil
@tag = nil

@log_level = nil
@log_file = nil
@daemon = nil
@pid_file_path = nil
Expand Down Expand Up @@ -149,11 +155,7 @@ def tag
end

def log_level
ENV["DROONGA_LOG_LEVEL"] || config["log_level"] || default_log_level
end

def log_level=(level)
ENV["DROONGA_LOG_LEVEL"] = level
@log_level || config["log_level"] || default_log_level
end

def log_file_path
Expand Down Expand Up @@ -272,7 +274,7 @@ def add_log_options(parser)
"The log level of the Droonga engine",
"[#{levels_label}]",
"(#{default_log_level})") do |level|
self.log_level = level
@log_level = level
end
parser.on("--log-file=FILE",
"Output logs to FILE",
Expand Down

0 comments on commit c97f2fa

Please sign in to comment.