-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.php
24 lines (15 loc) · 664 Bytes
/
cli.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
require __DIR__ . '/vendor/autoload.php';
const LOG_FILE = __DIR__ . '/var/ads.log';
$log = new Logger('AD System', [new StreamHandler(LOG_FILE)]);
try {
$request = Borovets\ADS\AdRequest::createFromConsoleArguments($argv);
$handler = new \Borovets\ADS\AdRequestHandler($log, $request);
$response = $handler->handle();
echo $response->render() . "\n\r";
} catch (\Borovets\ADS\Exception\Exception $exception) {
$log->critical('Catch exception:', ['exception' => (string) $exception]);
echo sprintf("Something like wrong. See log file in: %s \r\n", realpath(LOG_FILE));
}