Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
71312015
Commit
71312015
authored
Mar 08, 2013
by
Dave Marshall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use statements
parent
08669b72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
doc/cookbook/multiple_loggers.rst
doc/cookbook/multiple_loggers.rst
+6
-1
No files found.
doc/cookbook/multiple_loggers.rst
View file @
71312015
...
@@ -29,6 +29,8 @@ particular service separately, including your customizations.
...
@@ -29,6 +29,8 @@ particular service separately, including your customizations.
.. code-block:: php
.. code-block:: php
use Monolog\Handler\StreamHandler;
$app['monolog.payments'] = $app->share(function ($app) {
$app['monolog.payments'] = $app->share(function ($app) {
$log = new $app['monolog.logger.class']('payments');
$log = new $app['monolog.logger.class']('payments');
$handler = new StreamHandler($app['monolog.payments.logfile'], $app['monolog.payment.level']);
$handler = new StreamHandler($app['monolog.payments.logfile'], $app['monolog.payment.level']);
...
@@ -41,6 +43,9 @@ Alternatively, you could attempt to make the factory more complicated, and rely
...
@@ -41,6 +43,9 @@ Alternatively, you could attempt to make the factory more complicated, and rely
on some conventions.
on some conventions.
.. code-block:: php
.. code-block:: php
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
$app['monolog.factory'] = $app->protect(function ($name) use ($app) {
$app['monolog.factory'] = $app->protect(function ($name) use ($app) {
$log = new $app['monolog.logger.class']($name);
$log = new $app['monolog.logger.class']($name);
...
@@ -58,7 +63,7 @@ on some conventions.
...
@@ -58,7 +63,7 @@ on some conventions.
$app['monolog.payments.handlers'] = $app->share(function ($app) {
$app['monolog.payments.handlers'] = $app->share(function ($app) {
return array(
return array(
new
\Monolog\Handler\StreamHandler(__DIR__.'/../payments.log', \Monolog\
Logger::DEBUG),
new
StreamHandler(__DIR__.'/../payments.log',
Logger::DEBUG),
);
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment