Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser/formatter plugin helper with default @type in plugin side #1267

Merged
merged 3 commits into from
Oct 19, 2016

Conversation

tagomoris
Copy link
Member

@tagomoris tagomoris commented Oct 7, 2016

Adding multi: true for config_section :parse and config_section :format helps plugin authors not to use conf or default_type argument in parser_create and formatter_create.

With this change, plugin authors can write code to create parser(formatter) instances with default parser(formatter).

helpers :parser

config_section :parse do
  config_set_default :@type, 'myparser'
end

def configure(conf)
  super
  @parser = parser_create
end

After this change, parser(formatter) plugin helpers always requires default @type definition.
I believe that it's reasonable change for all plugins which uses parsers/formatters.

@tagomoris tagomoris added enhancement Feature request or improve operations v0.14 labels Oct 7, 2016
@tagomoris tagomoris self-assigned this Oct 7, 2016
This is needed to allow overriding default values in config sections.
…with default values specified in plugin code.

This change makes plugin authors to call `parser_create`/`formatter_create` without any arguments
to create parser/formatter instances with consideration about default values specified in plugin code.

If `conf` or `type` specified, plugin helper considers that plugin code will create plugin instance
manually, and skip plugin usage (default blank string).
This change includes:
* update `in_syslog` using parser helper, and shrink code of implementation
  * previous code works in different way by conf['format']
  * but it doesn't work well when `parser_syslog` used and `with_priority` is false
* delete duplicated implementation between `out_stdout` and `filter_stdout`(`formatter_stdout`)
@tagomoris
Copy link
Member Author

@repeatedly could you review this change please?

@tagomoris tagomoris removed their assignment Oct 18, 2016
@tagomoris tagomoris changed the title [WIP] parser/formatter plugin helper with default @type in plugin side parser/formatter plugin helper with default @type in plugin side Oct 19, 2016
@repeatedly
Copy link
Member

LGTM

@tagomoris tagomoris merged commit 675d1ad into master Oct 19, 2016
@tagomoris tagomoris deleted the unify-out-filter-stdout-formatting branch October 19, 2016 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or improve operations v0.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants