lib/remote_syslog/reader.rb in remote_syslog-1.6.1 vs lib/remote_syslog/reader.rb in remote_syslog-1.6.2

- old
+ new

@@ -2,10 +2,16 @@ require 'eventmachine' require 'eventmachine-tail' require 'em-dns-resolver' require 'syslog_protocol' +# Force eventmachine-tail not to change the encoding +# This will allow ruby 1.9 to deal with any file data +old_verbose, $VERBOSE = $VERBOSE, nil +EventMachine::FileTail::FORCE_ENCODING = false +$VERBOSE = old_verbose + module RemoteSyslog class Reader < EventMachine::FileTail COLORED_REGEXP = /\e\[(?:(?:[34][0-7]|[0-9]);){0,2}(?:[34][0-7]|[0-9])m/ def initialize(path, destination_address, destination_port, options = {}) @@ -65,8 +71,12 @@ packet.content = $4 if $4 && $4 != '' end end @socket.write(packet.assemble) + end + + def on_exception(exception) + puts "Exception: #{exception.class}: #{exception.message}\n\t#{exception.backtrace.join("\n\t")}" end end end