lib/remote_syslog/reader.rb in remote_syslog-1.5.1 vs lib/remote_syslog/reader.rb in remote_syslog-1.6.0
- old
+ new
@@ -11,10 +11,11 @@
def initialize(path, destination_address, destination_port, options = {})
super(path, -1)
@parse_fields = options[:parse_fields]
@strip_color = options[:strip_color]
+ @exclude_pattern = options[:exclude_pattern]
@socket = options[:socket] || UdpEndpoint.new(destination_address, destination_port)
@buffer = BufferedTokenizer.new
@@ -43,9 +44,11 @@
transmit(line)
end
end
def transmit(message)
+ return if @exclude_pattern && message =~ @exclude_pattern
+
message = message.gsub(COLORED_REGEXP, '') if @strip_color
packet = @packet.dup
packet.content = message