View definition

func LoggerFromCustomReceiver

Defined in


LoggerFromCustomReceiver creates a proxy logger that uses a CustomReceiver as the receiver.

All messages will be sent to the specified custom receiver without additional formatting ('%Msg' format is used).

Check CustomReceiver, RegisterReceiver for additional info.

NOTE 1: CustomReceiver.AfterParse is only called when a receiver is instantiated by the config parser while parsing config. So, if you are not planning to use the same CustomReceiver for both proxying (via LoggerFromCustomReceiver call) and loading from config, just leave AfterParse implementation empty.

NOTE 2: Unlike RegisterReceiver, LoggerFromCustomReceiver takes an already initialized instance that implements CustomReceiver. So, fill it with data and perform any initialization logic before calling this func and it won't be lost.

So: * RegisterReceiver takes value just to get the reflect.Type from it and then instantiate it as many times as config is reloaded.

* LoggerFromCustomReceiver takes value and uses it without modification and reinstantiation, directy passing it to the dispatcher tree.

LoggerFromCustomReceiver is referenced in 1 repository