Proper implementation of NLog and Prism

What would be the best way to implement NLog in a WPF Prism / CAL WPF application. This may be an amateur question, I'm a little new to the whole Prism system :)

I thought about putting a link to the NLog dll in the Infrastructure module and making a singleton class shell, for example. MyLogger. My thinking was to have a reference to the 1 logger implementation somewhere in a central location that everything refers to, and the only thing I know in Prism will be your infrastructure module.

An obvious other way is to add a link to the NLog for each module, but I think this will defeat the goal of decoupling and all that.

Any ideas would be most helpful.

Hi

+5
source share
1 answer

I would recommend something similar to your first idea, although it uses an existing interface in Prism.

While I'm not sure that the exact method signatures available to you in NLog, you might want to use the Prism ILoggerFacade interface , which is usually defined in your Bootstrapper (see the StockTraderRI app for an example of how this is configured). This usually acts as a switch to the Microsoft Composite Logging interface , but there is no reason why you cannot use this to connect to your own registrar.

A few reasons to consider this approach:

  • ILoggerFacade Prism,
  • , , ILoggerFacade

, : , NLog ( NLog) DLL . , . , , , ILoggerFacade.

+4

All Articles