lib/sapience/appender/stream.rb in sapience-1.0.5 vs lib/sapience/appender/stream.rb in sapience-1.0.6
- old
+ new
@@ -3,11 +3,11 @@
# Writes log messages to a file or open IO stream
#
module Sapience
module Appender
class Stream < Sapience::Subscriber
-
+ VALIDATION_MESSAGE = "stream is not writable".freeze
# Create a Stream Logger appender instance.
#
# Parameters
# :file_name [String|IO]
# Name of file to write to.
@@ -91,9 +91,13 @@
# Force all log entries to write immediately without buffering
# Allows multiple processes to write to the same log file simultaneously
@log.sync = true
@log.set_encoding(Encoding::BINARY) if @log.respond_to?(:set_encoding)
@log
+ end
+
+ def valid?
+ !@log.closed?
end
def ensure_folder_exist
return if ::File.exist?(@file_name)