Skip to content

Commit c3152d1

Browse files
committed
Add PSR logger
Signed-off-by: Lasse Mammen <lkm@bookboon.com>
1 parent e8f4d1f commit c3152d1

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

Resources/config/services.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ services:
1111
public: true
1212
factory: ['Bookboon\ApiBundle\Service\ApiFactory', create]
1313
arguments:
14-
- '@Bookboon\ApiBundle\Helper\ConfigurationHolder'
15-
- '@bookboon.cache'
14+
- '@Bookboon\ApiBundle\Helper\ConfigurationHolder'
15+
- '@bookboon.cache'
16+
- '@monolog.logger.api'
17+
tags:
18+
- { name: monolog.logger, channel: api }

Service/ApiFactory.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
use Bookboon\Api\Client\Oauth\OauthGrants;
88
use Bookboon\Api\Client\OauthClient;
99
use Bookboon\ApiBundle\Helper\ConfigurationHolder;
10+
use Psr\Log\LoggerInterface;
1011
use Psr\SimpleCache\CacheInterface;
1112

1213
class ApiFactory
1314
{
1415
/**
1516
* @param ConfigurationHolder $config
1617
* @param CacheInterface $cache
18+
* @param LoggerInterface $logger
1719
* @return Bookboon
20+
* @throws \Bookboon\Api\Exception\UsageException
1821
*/
19-
public static function create(ConfigurationHolder $config, CacheInterface $cache)
22+
public static function create(ConfigurationHolder $config, CacheInterface $cache, LoggerInterface $logger)
2023
{
2124
$bookboon = new Bookboon(
2225
new OauthClient(
@@ -28,7 +31,8 @@ public static function create(ConfigurationHolder $config, CacheInterface $cache
2831
'',
2932
null,
3033
$config->getOverrideAuthUri(),
31-
$config->getOverrideApiUri()
34+
$config->getOverrideApiUri(),
35+
$logger
3236
)
3337
);
3438

0 commit comments

Comments
 (0)