Created
August 17, 2017 12:39
-
-
Save nehalist/b9df22534f3b3525a50f410f3ed10284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
monolog: | |
channels: ['user_action_db', 'customer_email_db'] | |
handlers: | |
user_action_db: | |
channels: ['user_action_db'] | |
type: service | |
id: monolog.db_handler | |
customer_email_db: | |
channels: ['customer_email_db'] | |
type: service | |
id: monolog.db_handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DefaultController extends Controller | |
{ | |
/** | |
* @Route("/", name="homepage") | |
*/ | |
public function indexAction(Request $request) | |
{ | |
$this->get('monolog.logger.user_action_db')->info('test'); | |
// replace this example code with whatever you need | |
return $this->render('default/index.html.twig', [ | |
'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR, | |
]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Util; | |
use Monolog\Handler\AbstractProcessingHandler; | |
class MonologHandler extends AbstractProcessingHandler | |
{ | |
protected function write(array $record) | |
{ | |
// TODO: Implement write() method. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
services: | |
# ... | |
monolog.db_handler: | |
class: AppBundle\Util\MonologHandler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment