Comments (5)
I read in the docs that:
When the profiler is enabled, a handler is added to store the logs' messages in the profiler. The profiler uses the name "debug" so it is reserved and cannot be used in the configuration.
I figured out that the MonologBundle adds this handler with the help of an CompilerPass. I need the LoggerChannelPass
instance you create in here to add my own handler.
What is the sophisticated way to do that?
from monolog-bundle.
I guess you could iterate over all services to find the monolog.logger* ones and add the pushHandler call to them.
from monolog-bundle.
I just managed to add my handler programmatically. But the Symfony2 implementation of the getLogs()
method in the MonologBridge only offers the logs from the DebugLoggerInterface
.
It should be possible to do something like that:
class DemoController extends Controller
{
public function indexAction()
{
$channel = 'mychannel';
$logs = $this->logger->getLogs($channel);
}
}
I wont use a stream like a file to save my bundles logs. I want to get my log message to show it in an user friendly jQuery tracleog. The bundles configuration allows to enable / disable this behaviour.
from monolog-bundle.
For testing purpose I extend MonologBridge and add my HandlerInterface. But I think that is not a clean solution.
What do you think?
from monolog-bundle.
I don't get what you mean, a debug handler collects and returns you (in getLogs) everything that it received. If you only want one channel then either only add that handler to that channel, or filter the logs based on their channel key (though I see that this is not possible, but it could be added to the collected records array).
from monolog-bundle.
Related Issues (20)
- Monolog error after sentry added HOT 1
- fingers_crossed logs everything when a warning is logged HOT 1
- Deprecation warning on final class extension HOT 1
- Incompatibility with monolog 3.x HOT 1
- Segmentation fault on cache:clear when configuring symfony_mailer handler type HOT 4
- Bubble: false property doesn't work with doctrine channel like expected HOT 1
- Suggestion: Allow 200 status code to exclude http codes
- Allow setting exclude_fields through the bundle configuration
- Exclude unecessary files with `.gitattributes` HOT 1
- No log generated when using excluded_http_codes with some sub handlers under group (symfony/monolog-bundle 3.x). HOT 3
- Misfunction with the default prod settings and when using custom query to login HOT 1
- How to catch SlackWebhookHandler exceptions? HOT 1
- Add support for `#[Target]` attribute to autowire channels HOT 5
- WithMonologChannel on argument instead of the class HOT 1
- Handler fingers_crossed set to "error" in production prevents login in Symfony 7 without any error HOT 3
- Reset service for logs buffer HOT 3
- Add support for setting the basePath on line formatter
- Channel not used when calling function outside of class HOT 3
- Using a custom handler with a nested handler
- XSD Schema not allow %env()% syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monolog-bundle.