Merge pull request #1053 from bhollis/logging
Allow logging to be sent to a file
This commit is contained in:
commit
764efe65cd
|
@ -1,15 +1,14 @@
|
|||
# Use the Ruby/Rails logger
|
||||
require 'active_support/core_ext/logger'
|
||||
require 'active_support/notifications'
|
||||
require 'active_support/buffered_logger'
|
||||
require 'thread'
|
||||
|
||||
module Middleman
|
||||
|
||||
# The Middleman Logger
|
||||
class Logger < ::Logger
|
||||
|
||||
# Force output to STDOUT
|
||||
def initialize(log_level=1, is_instrumenting=false, target=STDOUT)
|
||||
super(STDOUT)
|
||||
class Logger < ActiveSupport::BufferedLogger
|
||||
def initialize(log_level=1, is_instrumenting=false, target=$stdout)
|
||||
super(target)
|
||||
|
||||
self.level = log_level
|
||||
@instrumenting = is_instrumenting
|
||||
|
|
|
@ -48,6 +48,9 @@ module Middleman
|
|||
# @return [Middleman::Logger] The logger
|
||||
def self.logger(*args)
|
||||
if !@_logger || args.length > 0
|
||||
if args.length == 1 && (args.first.is_a?(::String) || args.first.respond_to?(:write))
|
||||
args = [0, false, args.first]
|
||||
end
|
||||
@_logger = ::Middleman::Logger.new(*args)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue