Skip to content

Commit

Permalink
Merge pull request #214 from quixoten/logger_fix
Browse files Browse the repository at this point in the history
Never close $stdout
  • Loading branch information
liveh2o committed Aug 27, 2014
2 parents e942d61 + a8e071c commit 3a32c1c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
10 changes: 0 additions & 10 deletions lib/protobuf/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@ module Logging
def self.initialize_logger(log_target=$stdout, log_level=::Logger::INFO)
@counter ||= 0
@counter = @counter + 1
old_logger = defined?(@logger) ? @logger : nil
@logger = Logger.new(log_target)
@logger.level = log_level
old_logger.close if old_logger and close_old_logger?
@logger
end

def self.close_old_logger=(boolean)
@close_old_logger = !!boolean
end

def self.close_old_logger?
defined?(@close_old_logger) ? @close_old_logger : true
end

def self.logger
defined?(@logger) ? @logger : initialize_logger
end
Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
::Protobuf::Logging.initialize_logger('/dev/null')
end

::Protobuf::Logging.close_old_logger = false

# Get rid of the deprecation env var if present (messes with specs).
ENV.delete("PB_IGNORE_DEPRECATIONS")

Expand Down

0 comments on commit 3a32c1c

Please sign in to comment.