Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 466d927

Browse files
committed
🚿
1 parent d4025be commit 466d927

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
},
2222
"require": {
2323
"php": "^7.2",
24-
"chillerlan/php-traits": "^1.1",
25-
"chillerlan/php-httpinterface": "^1.0",
24+
"chillerlan/php-traits": "^1.1.10",
25+
"chillerlan/php-httpinterface": "dev-master",
2626
"chillerlan/php-magic-apiclient": "dev-master",
2727
"psr/log": "^1.0",
2828
"psr/simple-cache": "^1.0"
2929
},
3030
"require-dev": {
3131
"chillerlan/php-curl": "^1.0",
32-
"chillerlan/php-database": "^2.0",
33-
"chillerlan/php-log": "^1.0",
32+
"chillerlan/php-database": "^2.0.2",
33+
"chillerlan/php-log": "^1.0.5",
3434
"phpunit/phpunit": "^7.1"
3535
},
3636
"autoload": {

examples/oauth-example-common.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
HTTPClientAbstract, HTTPResponseInterface, TinyCurlClient
1515
};
1616
use chillerlan\Logger\{
17-
Log, LogOptions, LogOptionsTrait, LogTrait, Output\LogOutputAbstract, Output\NullLogger
17+
Log, LogOptionsTrait, Output\LogOutputAbstract
1818
};
1919
use chillerlan\OAuth\{
2020
OAuthOptions, Storage\SessionTokenStorage
@@ -63,11 +63,9 @@
6363
use DatabaseOptionsTrait, LogOptionsTrait;
6464
};
6565

66-
/** @var \Psr\Log\LoggerInterface $logger */
67-
$nullLogger = (new Log)->addInstance(new NullLogger($options), 'nullLog');
66+
$logger = new Log;
6867

69-
/** @var \Psr\Log\LoggerInterface $logger */
70-
$logger = (new Log)->addInstance(
68+
$logger->addInstance(
7169
new class ($options) extends LogOutputAbstract{
7270

7371
protected function __log(string $level, string $message, array $context = null):void{
@@ -84,7 +82,6 @@ protected function __log(string $level, string $message, array $context = null):
8482

8583
/** @var \chillerlan\HTTP\HTTPClientInterface $http */
8684
$http = new class($options) extends HTTPClientAbstract{
87-
use LogTrait;
8885

8986
protected $client;
9087

@@ -95,23 +92,23 @@ public function __construct(ContainerInterface $options){
9592

9693
public function request(string $url, array $params = null, string $method = null, $body = null, array $headers = null):HTTPResponseInterface{
9794
$args = func_get_args();
98-
$this->debug('$args', $args);
95+
$this->logger->debug('$args', $args);
9996

10097
$response = $this->client->request(...$args);
101-
$this->debug(print_r($response, true));
98+
$this->logger->debug(print_r($response, true));
10299

103100
usleep(100000); // flood protection
104101
return $response;
105102
}
106103

107104
};
108105

109-
$http->setLogger($nullLogger);
106+
#$http->setLogger($logger);
110107

111108
/** @var \chillerlan\Database\Database $db */
112109
$db = new Database($options);
113-
$db->setLogger($nullLogger);
110+
#$db->setLogger($logger);
114111

115112
/** @var \chillerlan\OAuth\Storage\TokenStorageInterface $storage */
116113
$storage = new SessionTokenStorage($options); //new DBTokenStorage($options, $db);
117-
$storage->setLogger($nullLogger);
114+
#$storage->setLogger($logger);

src/Providers/OAuthInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
/**
1919
* @property string $serviceName
2020
* @property string $userRevokeURL
21+
*
22+
* from \Psr\Log\LoggerAwareTrait
23+
* @property \Psr\Log\LoggerInterface $logger
24+
* @method setLogger(\Psr\Log\LoggerInterface $logger)
25+
*
26+
* from \chillerlan\Traits\Classloader
27+
* @method mixed loadClass(string $class, string $type = null, ...$params)
2128
*/
2229
interface OAuthInterface{
2330

src/Storage/TokenStorageInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
use chillerlan\OAuth\Token;
1616

17+
/**
18+
* from \Psr\Log\LoggerAwareTrait
19+
* @property \Psr\Log\LoggerInterface $logger
20+
* @method setLogger(\Psr\Log\LoggerInterface $logger)
21+
*/
1722
interface TokenStorageInterface{
1823

1924
/**

0 commit comments

Comments
 (0)