-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespaced logger configuration #82
Comments
Hi, @jessmchung. |
That was definitely the initial intent when I created Cascade, however we hit a roadblock as Monolog does not support inheriting Loggers out of the box. See Seldaek/monolog#777 that got denied and closed unfortunately. But in your case, when you refer to "namespaced loggers", you think of Php namespaces that are used for class mapping. The original intent was a bit different. It was using namespaces to make children loggers inherit behavior from their parents: The As for your package, I can see some value especially when developing and/or debugging, however I don't know if I would use this kind of logging on Production except for very specific cases or implementation (let's say with some design patterns, etc.) I find it odd to link loggers to specific classes and I'm pretty sure you can achieve the same thing with processors (see IntrospectionProcessor) Thanks for your interest in Cascade! |
Yes, we're talking about a bit different concepts of "namespace" loggers. But anyway I want to clarify the main idea of "namespaced cascade" because seems like I haven't managed to articulate it clearly.
The idea not only in
Real life usage example: I have an application which consists of some major layers like db layer, cloud api integration layer, business logic layer etc. And I understand that I don't need I think it's something that can't be done using |
Again, Cascade cannot handle this at the moment, this would have to be done at the Monolog level and after youinstantiate your logger. The namespace (channel in Monolog terminology) is determined when we set the logger to Monolog's registry right here. What Cascade does is read a config file, configure logger(s) accordingly and set them to Monolog's registry so they are available at runtime. Processors is one way to go. The Another option would be to build a quick lib that would wrap Monolog and use its registry (or your own registry) and save your loggers to it using namespaces. You can use the same lazy loading approach as Cascade (see here). |
Hi, guys.
I think it would be nice to have a possibility to define namespace/class loggers. So I wrote monolog-cascade-namespaced library. It allows developers to have loggers for specific classes or loggers which will log all the messages from the classes which are in some namespace etc. You know, log4j style. If you need specific logger configuration in the place where you've instantiated it - just set up needed handlers/processors for a needed logger in a config file. Otherwise, you will be given a default logger.
Just want to know your opinion on this. Do you have any plans to implement something like this directly in monolog-cascade? If yes I would get it done. The reason why I haven't made a pull-request to monolog-cascade initially is I just thought it's not more than a wrapper for configuring monolog loggers. But then I thought over and decided to suggest merging)
The text was updated successfully, but these errors were encountered: