Add logging support for debugging
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
"league/climate": "^3.2",
|
||||
"rdlowrey/auryn": "^1.4.2",
|
||||
"webmozart/assert": "^1.2",
|
||||
"symfony/yaml": "^3.0"
|
||||
"symfony/yaml": "^3.0",
|
||||
"amphp/log": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6",
|
||||
|
||||
162
composer.lock
generated
162
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f51ea3db33f712c8b9038d0a66a4bbb3",
|
||||
"content-hash": "2eaf21a959712e9286b2819ca08ecb96",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
@@ -389,6 +389,67 @@
|
||||
],
|
||||
"time": "2018-03-17T12:24:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "amphp/log",
|
||||
"version": "v1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/amphp/log.git",
|
||||
"reference": "728678d6e751abeb54a4d2fc6e76ef977de3f43b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/amphp/log/zipball/728678d6e751abeb54a4d2fc6e76ef977de3f43b",
|
||||
"reference": "728678d6e751abeb54a4d2fc6e76ef977de3f43b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"amphp/amp": "^2",
|
||||
"amphp/byte-stream": "^1.3",
|
||||
"monolog/monolog": "^1.23"
|
||||
},
|
||||
"require-dev": {
|
||||
"amphp/file": "^0.3",
|
||||
"amphp/phpunit-util": "^1",
|
||||
"friendsofphp/php-cs-fixer": "^2.3",
|
||||
"phpunit/phpunit": "^6"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Amp\\Log\\": "src"
|
||||
},
|
||||
"files": [
|
||||
"src/functions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Niklas Keller",
|
||||
"email": "me@kelunik.com"
|
||||
},
|
||||
{
|
||||
"name": "Aaron Piotrowski",
|
||||
"email": "aaron@trowski.com"
|
||||
}
|
||||
],
|
||||
"description": "Non-blocking logging for PHP based on Amp and Monolog.",
|
||||
"homepage": "https://github.com/amphp/log",
|
||||
"keywords": [
|
||||
"amp",
|
||||
"amphp",
|
||||
"async",
|
||||
"log",
|
||||
"logger",
|
||||
"logging",
|
||||
"non-blocking"
|
||||
],
|
||||
"time": "2018-03-22T19:39:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "amphp/parallel",
|
||||
"version": "v0.2.5",
|
||||
@@ -807,22 +868,23 @@
|
||||
},
|
||||
{
|
||||
"name": "kelunik/acme",
|
||||
"version": "v0.5.1",
|
||||
"version": "v0.5.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/kelunik/acme.git",
|
||||
"reference": "5783e1209d7c0dd8f3dc2723bf7bc378997462cf"
|
||||
"reference": "26bfdbe167d295c046240b419a78a0cb6b3f9c1d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/kelunik/acme/zipball/5783e1209d7c0dd8f3dc2723bf7bc378997462cf",
|
||||
"reference": "5783e1209d7c0dd8f3dc2723bf7bc378997462cf",
|
||||
"url": "https://api.github.com/repos/kelunik/acme/zipball/26bfdbe167d295c046240b419a78a0cb6b3f9c1d",
|
||||
"reference": "26bfdbe167d295c046240b419a78a0cb6b3f9c1d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"amphp/amp": "^2",
|
||||
"amphp/artax": "^3",
|
||||
"namshi/jose": "^7",
|
||||
"psr/log": "^1.0",
|
||||
"sabre/uri": "^1"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -863,7 +925,7 @@
|
||||
"ssl",
|
||||
"tls"
|
||||
],
|
||||
"time": "2018-06-06T19:47:11+00:00"
|
||||
"time": "2018-06-08T12:28:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kelunik/certificate",
|
||||
@@ -975,6 +1037,84 @@
|
||||
],
|
||||
"time": "2018-04-29T16:43:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.23.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
||||
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"graylog2/gelf-php": "~1.0",
|
||||
"jakub-onderka/php-parallel-lint": "0.9",
|
||||
"php-amqplib/php-amqplib": "~2.4",
|
||||
"php-console/php-console": "^3.1.3",
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"phpunit/phpunit-mock-objects": "2.3.0",
|
||||
"ruflin/elastica": ">=0.90 <3.0",
|
||||
"sentry/sentry": "^0.13",
|
||||
"swiftmailer/swiftmailer": "^5.3|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||
"sentry/sentry": "Allow sending log messages to a Sentry server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "http://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "http://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2017-06-19T01:22:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "namshi/jose",
|
||||
"version": "7.2.3",
|
||||
@@ -2088,16 +2228,16 @@
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v2.0.14",
|
||||
"version": "v2.0.15",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "f6ce7dd93628088e1017fb5dd73b0b9fec7df9e5"
|
||||
"reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/f6ce7dd93628088e1017fb5dd73b0b9fec7df9e5",
|
||||
"reference": "f6ce7dd93628088e1017fb5dd73b0b9fec7df9e5",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/10bcb46e8f3d365170f6de9d05245aa066b81f09",
|
||||
"reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2133,7 +2273,7 @@
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2018-06-06T17:40:22+00:00"
|
||||
"time": "2018-06-08T15:26:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
|
||||
@@ -2,12 +2,27 @@
|
||||
|
||||
namespace Kelunik\AcmeClient;
|
||||
|
||||
use Amp\ByteStream\ResourceOutputStream;
|
||||
use Amp\Log\ConsoleFormatter;
|
||||
use Amp\Log\StreamHandler;
|
||||
use Kelunik\Acme\AcmeClient;
|
||||
use Kelunik\Acme\AcmeService;
|
||||
use Kelunik\Acme\Crypto\PrivateKey;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
class AcmeFactory {
|
||||
public function build(string $directory, PrivateKey $keyPair): AcmeService {
|
||||
return new AcmeService(new AcmeClient($directory, $keyPair));
|
||||
$logger = null;
|
||||
if (\getenv('ACME_LOG')) {
|
||||
$logger = new Logger('acme');
|
||||
$logger->pushProcessor(new PsrLogMessageProcessor);
|
||||
|
||||
$handler = new StreamHandler(new ResourceOutputStream(\STDERR));
|
||||
$handler->setFormatter(new ConsoleFormatter(null, null, true, true));
|
||||
$logger->pushHandler($handler);
|
||||
}
|
||||
|
||||
return new AcmeService(new AcmeClient($directory, $keyPair, null, null, $logger));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user