Adding custom Logging to container #313
-
As stated in the documentation, it is a good idea to implement Logging. So I created my own LogFactory and added a custom implementation to get the Logging from the Stylet frame work to:
Great! Next, I set my LogFactory to a LogToMemory:
To avoid confusion, and because its short, I Implement ILog in LogToMemory. The question is, how to do that? For now I've done:
but that is obvious not doing the job. To be complete MyLogManager:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I'm a little bit confused as to what your question is I'm afraid.
What are you trying to do by registering I'm also not sure what "but that is obvious not doing the job" means -- why is it obvious that it's not doing a job? What's wrong with it? Perhaps the problem is that all public class SomeViewModel
{
public SomeViewModel(ILog<SomeViewModel> logger) { ... }
} You can then bind this to a generic |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your help! As it turns out, I do not need a LogManager at all, and I also ditched the LogToNull. For future reference, this is how I did it:
In the constructor of the implementation:
And finally the binding:
|
Beta Was this translation helpful? Give feedback.
I'm a little bit confused as to what your question is I'm afraid.
ILog
andMyLogManager
? Fine, I assume your code is using yourMyLogManager
to get logger instances?ILog
with the container, and bypass theMyLogManager
altogether.What are you trying to do by registering
ILog
with the container? Are you trying to inject loggers into other types? If so, why doesn't this registration involve theMyLogManager
at all?I'm also not sure what "but that is obvious not doing the job" means -- why is it obvious that it's n…