tagomoris / fluent-plugin-parser

Other
74 stars 23 forks source link

add 'unmatch_silent' to configuration. #4

Closed reiki4040 closed 11 years ago

reiki4040 commented 11 years ago

Hi, I add new optional configuration 'unmatch silent' to fluent-plugin-parser.

'unmatch_silent' is optional configuration that suppress 'pattern not match' log. default value is 'false' (it means show 'pattern not match' log)

user can choose output 'pattern not match' to log or not. for example, if it is known that the message does not match the pattern.

if this update is OK, please merge.

I wrote description to blog in japanese. http://d.hatena.ne.jp/reiki4040/20130220/1361372494

tagomoris commented 11 years ago

Please add test! You can test this patch by check for "$log.warn" is called or not, like below:

  class DummyLoggerWarnedException < StandardError; end
  class DummyLogger
    def warn(...)
      raise DummyLoggerWarnedException
    end
  end
  saved_logger = $log
  $log = DummyLogger.new
  d = create_driver # with new option disabled
  assert_raise(DummyLoggerWarnedException) {
    d.run
      ...
    end
  }
  d = create_driver # with new option enabled
  assert_not_raised {
    d.run
      ...
    end
  }
  $log = saved_logger

And please change option name suppress_parse_error_log. (ok, this name is long, but this configuration is abnormal setting.)

reiki4040 commented 11 years ago

I changed name to 'suppress_parse_error_log' and added the test. thank you for example test code.

'rake test' is OK.

ok, this name is long, but this configuration is abnormal setting.

I think so too. it is appropriate name and reason.

tagomoris commented 11 years ago

Good code! I'll check at my pc, and then merge (and release) later.

tagomoris commented 11 years ago

Merged and released v0.2.2. Thanks!

reiki4040 commented 11 years ago

Thank you!!