Skip to content

Commit

Permalink
Merge pull request #15 from IanSimpson/logger-fixes2
Browse files Browse the repository at this point in the history
Allow overriding logger from subclasses of OAuthController
  • Loading branch information
mateusz authored Oct 15, 2018
2 parents 0d2d7ab + d5b3141 commit 09d5344
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ Director:
rules:
'oauth': 'IanSimpson\OauthServerController'
Injector:
Logger:
class: 'Logger'
OAuthLogger:
factory: 'IanSimpson\LogFactory'
4 changes: 2 additions & 2 deletions code/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OauthServerController extends \Controller
/**
* @var LoggerInterface
*/
private $logger;
protected $logger;

/**
* @var Authenticator classes on which to show an athentication greeting message.
Expand Down Expand Up @@ -102,7 +102,7 @@ public function __construct()
new \DateInterval('PT1H') // new access tokens will expire after 1 hour
);

$this->logger = Injector::inst()->get('Logger');
$this->logger = Injector::inst()->get('OAuthLogger');

parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/OauthServerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function setUp()
->disableOriginalConstructor()
->getMock();

Injector::inst()->registerService($this->logger, 'Logger');
Injector::inst()->registerService($this->logger, 'OAuthLogger');
}

public function tearDown()
Expand Down

0 comments on commit 09d5344

Please sign in to comment.