-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fixed logger processor example #8226
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
Conversation
@@ -59,8 +59,8 @@ using a processor. | |||
arguments: | |||
- "[%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%%\n" | |||
|
|||
monolog.processor.session_request: | |||
class: AppBundle\SessionRequestProcessor | |||
app.logger.session_request_processor: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an FQCN from 3.3
use Monolog\Formatter\LineFormatter; | ||
|
||
$container | ||
->register('monolog.formatter.session_request', LineFormatter::class) | ||
->addArgument('[%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%%\n'); | ||
|
||
$container | ||
->register('monolog.processor.session_request', SessionRequestProcessor::class) | ||
->register('app.logger.session_request_processor', SessionRequestProcessor::class) | ||
->addArgument(new Reference('session')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'session'
should be SessionInterface::class
from 3.3
logging/processors.rst
Outdated
$this->sessionId = substr($this->session->getId(), 0, 8) ?: '????????'; | ||
} | ||
|
||
$record['extra']['token'] = $this->sessionId.'-'.substr(uniqid(), -8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should pass true
as the second argument to uniqid()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, done!
f51156a
to
24ddb64
Compare
Thank you @HeahDude. |
Fixes #7897.