8000 [FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger by lyrixx · Pull Request #21933 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger #21933

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

Merged
merged 2 commits into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Workflow] Added the workflow name in log generated by AuditTrailList…
…ener
  • Loading branch information
lyrixx committed Mar 8, 2017
commit 633c0393b31d0ac4aff24bb53dbe17010ad25de3
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ public function __construct(LoggerInterface $logger)
public function onLeave(Event $event)
{
foreach ($event->getTransition()->getFroms() as $place) {
$this->logger->info(sprintf('Leaving "%s" for subject of class "%s".', $place, get_class($event->getSubject())));
$this->logger->info(sprintf('Leaving "%s" for subject of class "%s" in workflow "%s".', $place, get_class($event->getSubject()), $event->getWorkflowName()));
}
}

public function onTransition(Event $event)
{
$this->logger->info(sprintf('Transition "%s" for subject of class "%s".', $event->getTransition()->getName(), get_class($event->getSubject())));
$this->logger->info(sprintf('Transition "%s" for subject of class "%s" in workflow "%s".', $event->getTransition()->getName(), get_class($event->getSubject()), $event->getWorkflowName()));
}

public function onEnter(Event $event)
{
foreach ($event->getTransition()->getTos() as $place) {
$this->logger->info(sprintf('Entering "%s" for subject of class "%s".', $place, get_class($event->getSubject())));
$this->logger->info(sprintf('Entering "%s" for subject of class "%s" in workflow "%s".', $place, get_class($event->getSubject()), $event->getWorkflowName()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function testItWorks()
$workflow->apply($object, 't1');

$expected = array(
'Leaving "a" for subject of class "stdClass".',
'Transition "t1" for subject of class "stdClass".',
'Entering "b" for subject of class "stdClass".',
'Leaving "a" for subject of class "stdClass" in workflow "unnamed".',
'Transition "t1" for subject of class "stdClass" in workflow "unnamed".',
'Entering "b" for subject of class "stdClass" in workflow "unnamed".',
);

$this->assertSame($expected, $logger->logs);
Expand Down
0