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

Commit f1f065e

Browse files
committed
🛀
1 parent 466d927 commit f1f065e

File tree

4 files changed

+9
-40
lines changed

4 files changed

+9
-40
lines changed

composer.json

Lines changed: 3 additions & 3 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.10",
24+
"chillerlan/php-traits": "^1.1",
2525
"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.2",
33-
"chillerlan/php-log": "^1.0.5",
32+
"chillerlan/php-database": "^2.0",
33+
"chillerlan/php-log": "^1.0",
3434
"phpunit/phpunit": "^7.1"
3535
},
3636
"autoload": {

examples/oauth-example-common.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
HTTPClientAbstract, HTTPResponseInterface, TinyCurlClient
1515
};
1616
use chillerlan\Logger\{
17-
Log, LogOptionsTrait, Output\LogOutputAbstract
17+
Log, LogOptionsTrait, Output\ConsoleLog, Output\LogOutputAbstract
1818
};
1919
use chillerlan\OAuth\{
2020
OAuthOptions, Storage\SessionTokenStorage
@@ -64,21 +64,7 @@
6464
};
6565

6666
$logger = new Log;
67-
68-
$logger->addInstance(
69-
new class ($options) extends LogOutputAbstract{
70-
71-
protected function __log(string $level, string $message, array $context = null):void{
72-
echo $message.PHP_EOL;
73-
74-
if(!empty($context)){
75-
echo print_r($context, true).PHP_EOL;
76-
}
77-
}
78-
79-
},
80-
'console'
81-
);
67+
$logger->addInstance(new ConsoleLog($options), 'console');
8268

8369
/** @var \chillerlan\HTTP\HTTPClientInterface $http */
8470
$http = new class($options) extends HTTPClientAbstract{

tests/API/APITestAbstract.php

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
HTTPClientAbstract, HTTPClientInterface, HTTPOptionsTrait, HTTPResponseInterface, TinyCurlClient
1717
};
1818
use chillerlan\Logger\{
19-
Log, LogOptionsTrait, Output\LogOutputAbstract
19+
Log, LogOptionsTrait, Output\ConsoleLog, Output\LogOutputAbstract
2020
};
2121
use chillerlan\OAuth\{
2222
OAuthOptions, Providers\OAuthInterface, Storage\MemoryTokenStorage, Storage\TokenStorageInterface, Token
@@ -99,8 +99,10 @@ protected function setUp(){
9999
protected $sleep;
100100
};
101101

102+
$this->logger = new Log;
103+
$this->logger->addInstance(new ConsoleLog($options), 'console');
104+
102105
$this->storage = new MemoryTokenStorage;
103-
$this->logger = $this->initLogger($this->options);
104106
$this->http = $this->initHttp($this->options);
105107
$this->provider = $this->initProvider($this->http, $this->storage, $this->options, $this->logger);
106108

@@ -135,24 +137,6 @@ protected function getOptions(string $cfgdir):array {
135137
];
136138
}
137139

138-
/**
139-
* @param \chillerlan\Traits\ContainerInterface $options
140-
*
141-
* @return \Psr\Log\LoggerInterface
142-
*/
143-
protected function initLogger(ContainerInterface $options):LoggerInterface{
144-
return (new Log)->addInstance(
145-
new class ($options) extends LogOutputAbstract{
146-
147-
protected function __log(string $level, string $message, array $context = null):void{
148-
echo $message.PHP_EOL.print_r($context, true).PHP_EOL;
149-
}
150-
151-
},
152-
'console'
153-
);
154-
}
155-
156140
/**
157141
* @param \chillerlan\HTTP\HTTPClientInterface $http
158142
* @param \chillerlan\OAuth\Storage\TokenStorageInterface $storage

tests/StorageTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
ClassLoader, DotEnv
2626
};
2727
use PHPUnit\Framework\TestCase;
28-
use Psr\Log\NullLogger;
2928

3029
class StorageTest extends TestCase{
3130
use ClassLoader;

0 commit comments

Comments
 (0)