Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never close $stdout #214

Merged
merged 2 commits into from
Aug 27, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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