Commit e5f4130a authored by ash's avatar ash

Add the logger and related configuration options.

parent 5519420e
...@@ -31,6 +31,14 @@ class GitlabConfig ...@@ -31,6 +31,14 @@ class GitlabConfig
redis['namespace'] || 'resque:gitlab' redis['namespace'] || 'resque:gitlab'
end end
def log_file
@config['log_file'] ||= File.join(ROOT_PATH, 'log', 'gitlab_shell.log')
end
def log_level
@config['log_level'] ||= 'INFO'
end
# Build redis command to write update event in gitlab queue # Build redis command to write update event in gitlab queue
def redis_command def redis_command
if redis.empty? if redis.empty?
......
require 'logger'
require_relative 'gitlab_config'
def convert_log_level log_level
Logger.const_get(log_level.upcase)
rescue NameError
$stderr.puts "WARNING: Unrecognized log level #{log_level.inspect}."
$stderr.puts "WARNING: Falling back to INFO."
Logger::INFO
end
config = GitlabConfig.new
$logger = Logger.new(config.log_file)
$logger.level = convert_log_level(config.log_level)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment