Skip to content

Commit

Permalink
Allow to use STDOUT as log output
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikko Kokkonen committed Apr 6, 2016
1 parent 6425c1e commit c9452fa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/forklift/base/logger.rb
Expand Up @@ -18,7 +18,12 @@ def messages

def logger
log_dir = "#{forklift.config[:project_root]}/log"
@logger ||= ::Lumberjack::Logger.new("#{log_dir}/forklift.log", buffer_size: 0)
@logger ||= case forklift.config[:logger][:output]
when :stdout
::Lumberjack::Logger.new(Lumberjack::Device::Writer.new(STDOUT), buffer_size: 0)
else
::Lumberjack::Logger.new("#{log_dir}/forklift.log", buffer_size: 0)
end
end

def log(message, severity="info")
Expand All @@ -45,5 +50,5 @@ def fatal(message)
end

end
end
end
end

0 comments on commit c9452fa

Please sign in to comment.