daspisch daspisch - 7 months ago 20
C# Question

Send event from NLog target using AppccelerateEventBroker

I want to put log messages to console and part of UI of my app simultaneously. But i cant find a way to do it with ninject.

I have a logger injected by ninject, and it perfectly make output to console and custom target. But I can't subscribe target to event broker because target initialization was outside ninject life-cycle.

Can anyone make some advice with this? How i can display logs in my UI?


Thanks to BatteryBackupUnit i found how to resolve this situation. First of all We need to inject logs target to kernel kernel.Bind<IMyTarget>().To<MyTarget>(); And then make a custom instantiation method NLog.Config.ConfigurationItemFactory.Default.CreateInstance = (type) => kernel.TryGet(type);