Using the Log in View

Dec 24, 2013 at 1:19 PM
Hi,

I want to use the log in some of my Views, as I can't avoid writing code-behind to perform some drag&drop action. I'm not sure how the log is included in the viewmodels. I've found out that all viewmodels ultimately derive from LogAwareObject and that there is a ILogWrapper property there. However, it doesn't seem to be imported by DI. How can I add the Log to my ViewModel? I've tried importing a ILogWrapper property in my view-class, but this doesn't work.

Thanks for the help!
SR
Coordinator
Dec 24, 2013 at 2:56 PM
Hi SR,

So as you where saying the LogAwareObject has a property Log that's intended for you to use when you want to log. It's also true that the property isn't injected by the container.

It should lazily instantiate a logger for you. Try logging an error to it and you should break in the debug logger.


i like the idea though of being able to inject a logger for classes that don't inherit from logAwareObject.

If you have any issues let me know.

-Ian