YeshiGoku
YeshiGoku

Reputation: 23

Call A method in controller from Nlog config

I need to send an email every time the Nlog config writes into the database. Can i call a method in my controller from Nlog Config?

Upvotes: 1

Views: 581

Answers (1)

Athanasios Kataras
Athanasios Kataras

Reputation: 26430

  1. You can call static methods from configuration: https://github.com/NLog/NLog/wiki/MethodCall-target

  2. You can send to an email from configuration: https://github.com/nlog/NLog/wiki/Mail-target

But since 1 is very clear about it, you need to have a static, public method which your controller isn't

Upvotes: 1

Related Questions