Imagine you need a way to be notified about emergencies happening on production in a fraction of second. Adding NLog.Ifttt extension to you logging infrastructure will allow to create a seamless integration with the software that is always by the hand.
Install-Package NLog.Ifttt
or
dotnet add NLog.Ifttt
- Add to your NLog.config
<extensions>
<add assembly="NLog.Ifttt"/>
</extensions>
<variable name="ifttt_event" value="production_error" />
<variable name="ifttt_key" value="you_key_goes_here" />
<target xsi:type="Ifttt"
name="ifttt"
eventName="${ifttt_event}"
key="${ifttt_key}"
layout="${layout}"
value1="${appName}"
value2="${uppercase:${level}}"
layoutLocation="Value3">
</target>
<logger name="notificationLogger" minlevel="Info" writeTo="ifttt" final="true"/>
- Obtain url and key here https://ifttt.com/maker_webhooks/settings
- Setup Ifttt with a desired way of communication (I prefer Telegram)
- Once you have something in the NLog logger you will get a message 😉) Imgur
- Enjoy!