Skip to content

Commit

Permalink
Merge pull request #2059 from alcaeus/add-commandlogger-interface
Browse files Browse the repository at this point in the history
Introduce interface for command loggers
  • Loading branch information
alcaeus authored Sep 23, 2019
2 parents d78a073 + f7021a2 commit 7c3e82c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Doctrine/ODM/MongoDB/APM/CommandLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
use Countable;
use MongoDB\Driver\Monitoring\CommandFailedEvent;
use MongoDB\Driver\Monitoring\CommandStartedEvent;
use MongoDB\Driver\Monitoring\CommandSubscriber;
use MongoDB\Driver\Monitoring\CommandSucceededEvent;
use function count;
use function MongoDB\Driver\Monitoring\addSubscriber;
use function MongoDB\Driver\Monitoring\removeSubscriber;

final class CommandLogger implements Countable, CommandSubscriber
final class CommandLogger implements Countable, CommandLoggerInterface
{
/** @var Command[] */
private $commands = [];
Expand Down
20 changes: 20 additions & 0 deletions lib/Doctrine/ODM/MongoDB/APM/CommandLoggerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Doctrine\ODM\MongoDB\APM;

use MongoDB\Driver\Monitoring\CommandSubscriber;

interface CommandLoggerInterface extends CommandSubscriber
{
/**
* Registers this command logger instance with the MongoDB library so it can receive command events
*/
public function register() : void;

/**
* Unregisters this command logger instance with the MongoDB library so it no longer receives command events
*/
public function unregister() : void;
}

0 comments on commit 7c3e82c

Please sign in to comment.