Skip to content

Commit

Permalink
skip the regexp if there is no %
Browse files Browse the repository at this point in the history
  • Loading branch information
fetep committed Jul 11, 2012
1 parent 48375c1 commit 9646be9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/logstash/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def remove(field)
# is an array (or hash?) should be. Join by comma? Something else?
public
def sprintf(format)
if format.index("%").nil?
return format
end

return format.gsub(/%\{[^}]+\}/) do |tok|
# Take the inside of the %{ ... }
key = tok[2 ... -1]
Expand Down

0 comments on commit 9646be9

Please sign in to comment.