View definition


Defined in


CustomReceiverProducers expose the same functionality as RegisterReceiver func but only in the scope (context) of the config parse func instead of a global package scope.

It means that if you use custom receivers in your code, you may either register them globally once with RegisterReceiver or you may call funcs like LoggerFromParamConfigAsFile (with 'ParamConfig') and use CustomReceiverProducers to provide custom producer funcs.

A producer func is called when config parser processes a '<custom>' element. It takes the 'name' attribute of the element and tries to find a match in two places: 1) CfgParseParams.CustomReceiverProducers map 2) Global type map, filled by RegisterReceiver

If a match is found in the CustomReceiverProducers map, parser calls the corresponding producer func passing the init args to it. The func takes exactly the same args as CustomReceiver.AfterParse. The producer func must return a correct receiver or an error. If case of error, seelog will behave in the same way as with any other config error.

You may use this param to set custom producers in case you need to pass some context when instantiating a custom receiver or if you frequently change custom receivers with different parameters or in any other situation where package-level registering (RegisterReceiver) is not an option for you.

CustomReceiverProducers is referenced in 1 repository