Introducing NLog to SignalR

{  NLog+SignalR+Toastr==NLogToSignalR }

I have created a simple NLog target which uses SignalR (calling it NLogToSignalR) under the covers and delivers the log to either Hub or PersistentConnection and deliver nice messages using toastr.

Where does it fit?

Schematic

Purpose

If you use NLog as a logging tool, you can use this to deliver log messages to either same (or remote server) in real time in true toastr style

e.g. Information can be displayed as

Information

Warning

Warning

Error

Error

How does this work?

You need follow these steps:

1. Put NLog.Targets.SignalR in the same folder as your App.Config/ Web.Config file

2. If you are going to be using Hub for SignalR, use following configuration

nlogconfig

3. Deploy the Server NLog.Targets.SignalR.AspNetServer on local IIS.

4. Browse the website after deployment. (Ensure .NET Framework 4.5 is installed)

5. Start logging and watch the logs in real time.

The code is available for download from github.

Enjoy!