symfony - How to read logs from Monolog in my application? -
my symfony application runs calculations based on user's request. i'd send them email response.
i have created custom channel , handler in config.yml
:
# config.yml # ... monolog: handlers: buildbot: level: info type: stream channels: [buildbot]
now write logs various services:
<?php // appbundle/services/buildbot.php $this->buildlogger->info('fabricating robot shell');
in service want email requestor log lines "buildbot" monolog channel. how can read log lines?
from design perspective don’t think symfony’s logger right tool use task. in opinion logger meant log information application’s activities may or may not useful developer (or other kinds of administrators).
whereas in use case log meant end user , doesn’t contain application-level information request-level information. separate that.
my personal approach create simple service (that might implement logger interface) accepts messages, subscribes kernel.terminate
event , sends combined messages user in end.
anyway, if want monolog, should handlers. here list of available handlers whereas here , here symfony-specific examples on how configure them. have write own mailing handler because packaged 1 assumes there static recipient whereas want mail sent current user.
Comments
Post a Comment