lib/semantic_logger/appender/file.rb in semantic_logger-2.15.0 vs lib/semantic_logger/appender/file.rb in semantic_logger-2.16.0

- old
+ new

@@ -38,17 +38,18 @@ # # logger = SemanticLogger['test'] # logger.info 'Hello World' # def initialize(filename, level=nil, filter=nil, &block) - raise "filename cannot be null when initializing the SemanticLogging::Appender::File" unless filename - @log = if filename.respond_to?(:write) and filename.respond_to?(:close) - filename - else - @filename = filename - reopen - end + raise 'filename cannot be null when initializing the SemanticLogging::Appender::File' unless filename + @log = + if filename.respond_to?(:write) and filename.respond_to?(:close) + filename + else + @filename = filename + reopen + end # Set the log level and formatter if supplied super(level, filter, &block) end @@ -58,10 +59,10 @@ # Note: This method will only work if a String filename was supplied # on the initializer. def reopen return unless @filename - @log = open(@filename, (::File::WRONLY | ::File::APPEND | ::File::CREAT)) + @log = open(@filename, (::File::WRONLY | ::File::APPEND | ::File::CREAT)) # 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