From 6dfb64ce93ee578a9c6a71b5fc95f957cb4cc8da Mon Sep 17 00:00:00 2001 From: iMega Date: Sun, 23 Oct 2016 17:39:55 +0300 Subject: [PATCH] =?UTF-8?q?issue=20#116=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +- composer.lock | 82 ++++++++++++++++++++++++++++++++++++++++++++++++-- config/app.php | 10 +++++- web/app.php | 9 ++++++ 4 files changed, 100 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 877daec..023be83 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "firebase/php-jwt": "v4.0.0", "guzzlehttp/guzzle": "6.2.1", "packaged/querybuilder":"0.16.1", - "ramsey/uuid": "^3.5" + "ramsey/uuid": "^3.5", + "monolog/monolog": "^1.21" }, "require-dev": { "phpunit/phpunit": "5.5.5", diff --git a/composer.lock b/composer.lock index 1aa8cb3..a363ae0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "d5ccb0285d915c8876b2eb65f82d0715", - "content-hash": "c96ca78e6d3765cc7b44d75dc01259cc", + "hash": "03cdae4b04e9ab117206a16a9d0ba8c1", + "content-hash": "1def3ba81ec637df5067a2ad6e01ee05", "packages": [ { "name": "firebase/php-jwt", @@ -221,6 +221,84 @@ ], "time": "2016-06-24 23:00:38" }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "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", + "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" + }, + "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": "2016-07-29 03:23:52" + }, { "name": "packaged/helpers", "version": "1.5.0", diff --git a/config/app.php b/config/app.php index 96269ca..d3325db 100644 --- a/config/app.php +++ b/config/app.php @@ -177,5 +177,13 @@ $rangePosition['longitude'][MIN] <= $longitude && $longitude <= $rangePosition['longitude'][MAX]; }; - } + }, + 'logger' => function () { + $logger = new Monolog\Logger('kubikvest'); + $logger->setHandlers([ + new Monolog\Handler\StreamHandler('php://stdout'), + ]); + + return $logger; + }, ]; diff --git a/web/app.php b/web/app.php index a627f25..3c55d0f 100644 --- a/web/app.php +++ b/web/app.php @@ -187,6 +187,15 @@ 'finish' => false, ]; unset($response['point']['prompt']); + $app['logger']->log( + \Psr\Log\LogLevel::INFO, + 'Checkout', + [ + 'lat' => $data['lat'], + 'lng' => $data['lng'], + 'acr' => $data['acr'], + ] + ); if (! $point->checkCoordinates((double) $data['lat'], (double) $data['lng'])) { $distances = $point->calcDistanceToPointsSector((double) $data['lat'], (double) $data['lng']); if (! $point->checkAccuracy((int) $data['acr'], min($distances))) {