From bf9044d9f83fc1792d1f4cd1f535823f2608db76 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 22 Sep 2017 18:03:24 -0700 Subject: [PATCH 1/7] refactors logging api samples --- logging/api/composer.json | 5 +- logging/api/composer.lock | 409 +++++++++++++----- logging/api/logging.php | 184 +++++++- logging/api/phpunit.xml.dist | 3 + logging/api/src/BaseCommand.php | 78 ---- logging/api/src/CreateSinkCommand.php | 82 ---- logging/api/src/DeleteLoggerCommand.php | 46 -- logging/api/src/DeleteSinkCommand.php | 54 --- logging/api/src/ListEntriesCommand.php | 68 --- logging/api/src/ListSinksCommand.php | 51 --- logging/api/src/UpdateSinkCommand.php | 71 --- logging/api/src/WriteCommand.php | 54 --- .../{functions => }/log_entry_functions.php | 20 +- .../src/{functions => }/sink_functions.php | 12 +- logging/api/test/CreateSinkCommandTest.php | 93 ---- logging/api/test/DeleteLoggerCommandTest.php | 78 ---- logging/api/test/DeleteSinkCommandTest.php | 88 ---- logging/api/test/ListEntriesCommandTest.php | 89 ---- logging/api/test/ListSinksCommandTest.php | 103 ----- logging/api/test/UpdateSinkCommandTest.php | 140 ------ logging/api/test/WriteCommandTest.php | 71 --- logging/api/test/loggingTest.php | 202 +++++++++ 22 files changed, 693 insertions(+), 1308 deletions(-) delete mode 100644 logging/api/src/BaseCommand.php delete mode 100644 logging/api/src/CreateSinkCommand.php delete mode 100644 logging/api/src/DeleteLoggerCommand.php delete mode 100644 logging/api/src/DeleteSinkCommand.php delete mode 100644 logging/api/src/ListEntriesCommand.php delete mode 100644 logging/api/src/ListSinksCommand.php delete mode 100644 logging/api/src/UpdateSinkCommand.php delete mode 100644 logging/api/src/WriteCommand.php rename logging/api/src/{functions => }/log_entry_functions.php (76%) rename logging/api/src/{functions => }/sink_functions.php (84%) delete mode 100644 logging/api/test/CreateSinkCommandTest.php delete mode 100644 logging/api/test/DeleteLoggerCommandTest.php delete mode 100644 logging/api/test/DeleteSinkCommandTest.php delete mode 100644 logging/api/test/ListEntriesCommandTest.php delete mode 100644 logging/api/test/ListSinksCommandTest.php delete mode 100644 logging/api/test/UpdateSinkCommandTest.php delete mode 100644 logging/api/test/WriteCommandTest.php create mode 100644 logging/api/test/loggingTest.php diff --git a/logging/api/composer.json b/logging/api/composer.json index 976abf9033..283de084a2 100644 --- a/logging/api/composer.json +++ b/logging/api/composer.json @@ -8,10 +8,9 @@ "google/cloud-tools": "^0.6" }, "autoload": { - "psr-4": { "Google\\Cloud\\Samples\\Logging\\": "src" }, "files": [ - "src/functions/log_entry_functions.php", - "src/functions/sink_functions.php" + "src/log_entry_functions.php", + "src/sink_functions.php" ] } } diff --git a/logging/api/composer.lock b/logging/api/composer.lock index f6fc4abc9e..1172baeabf 100644 --- a/logging/api/composer.lock +++ b/logging/api/composer.lock @@ -8,21 +8,24 @@ "packages": [ { "name": "firebase/php-jwt", - "version": "v4.0.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35" + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": " 4.8.35" + }, "type": "library", "autoload": { "psr-4": { @@ -47,25 +50,25 @@ ], "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", "homepage": "https://github.com/firebase/php-jwt", - "time": "2016-07-18T04:51:16+00:00" + "time": "2017-06-27T22:17:23+00:00" }, { "name": "google/auth", - "version": "v0.11.1", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/google/google-auth-library-php.git", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d" + "reference": "db8e3022a308cb0e988026d38e67b91a42b41622" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/a240674b08a09949fd5597f7590b3ed83663a12d", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/db8e3022a308cb0e988026d38e67b91a42b41622", + "reference": "db8e3022a308cb0e988026d38e67b91a42b41622", "shasum": "" }, "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0", - "guzzlehttp/guzzle": "~5.3|~6.0", + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "~5.3.1|~6.0", "guzzlehttp/psr7": "~1.2", "php": ">=5.4", "psr/cache": "^1.0", @@ -95,24 +98,24 @@ "google", "oauth2" ], - "time": "2016-11-02T14:59:14+00:00" + "time": "2017-07-31T16:34:40+00:00" }, { "name": "google/cloud-core", - "version": "v1.5.1", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-core.git", - "reference": "145cc80d8eeb03ad677733ca2a5a9bcf4fc3def9" + "reference": "17d0a5150ebb21e8980adf1ea199d53f7a611d17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-core/zipball/145cc80d8eeb03ad677733ca2a5a9bcf4fc3def9", - "reference": "145cc80d8eeb03ad677733ca2a5a9bcf4fc3def9", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-core/zipball/17d0a5150ebb21e8980adf1ea199d53f7a611d17", + "reference": "17d0a5150ebb21e8980adf1ea199d53f7a611d17", "shasum": "" }, "require": { - "google/auth": "^0.11", + "google/auth": "~0.9|^1.0", "guzzlehttp/guzzle": "^5.3|^6.0", "guzzlehttp/psr7": "^1.2", "monolog/monolog": "~1", @@ -123,13 +126,16 @@ "suggest": { "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" }, + "bin": [ + "bin/google-cloud-batch" + ], "type": "library", "extra": { "component": { "id": "cloud-core", "target": "GoogleCloudPlatform/google-cloud-php-core.git", "path": "src/Core", - "entry": null + "entry": "ServiceBuilder.php" } }, "autoload": { @@ -142,28 +148,26 @@ "Apache-2.0" ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", - "time": "2017-05-25T15:15:05+00:00" + "time": "2017-09-12T20:49:36+00:00" }, { "name": "google/cloud-logging", - "version": "v1.2.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-logging.git", - "reference": "1a5f4a5b2fe418aac23bc7bb962a9a831377233b" + "reference": "0a06fcf1c0ead3e5491d3a68ffb0ef1d7b308f93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-logging/zipball/1a5f4a5b2fe418aac23bc7bb962a9a831377233b", - "reference": "1a5f4a5b2fe418aac23bc7bb962a9a831377233b", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-logging/zipball/0a06fcf1c0ead3e5491d3a68ffb0ef1d7b308f93", + "reference": "0a06fcf1c0ead3e5491d3a68ffb0ef1d7b308f93", "shasum": "" }, "require": { - "google/cloud-core": "^1.0" - }, - "suggest": { - "google/gax": "Required to support gRPC", - "google/proto-client-php": "Required to support gRPC" + "google/cloud-core": "^1.0", + "google/gax": "^0.23", + "google/proto-client": "^0.23" }, "type": "library", "extra": { @@ -184,20 +188,186 @@ "Apache-2.0" ], "description": "Stackdriver Logging Client for PHP", - "time": "2017-05-18T15:22:19+00:00" + "time": "2017-09-12T20:49:36+00:00" + }, + { + "name": "google/gax", + "version": "0.23.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/gax-php.git", + "reference": "e09f219ed50ea1f6162d1945156d2ea6af6cd1f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/e09f219ed50ea1f6162d1945156d2ea6af6cd1f9", + "reference": "e09f219ed50ea1f6162d1945156d2ea6af6cd1f9", + "shasum": "" + }, + "require": { + "google/auth": "~0.9|^1.0", + "google/protobuf": "^3.4", + "grpc/grpc": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\GAX\\": "src/", + "Google\\GAX\\UnitTests\\": "tests/", + "Google\\": "src/generated/Google/", + "GPBMetadata\\": "src/generated/GPBMetadata/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Google API Extensions for PHP", + "homepage": "https://github.com/googleapis/gax-php", + "keywords": [ + "google" + ], + "time": "2017-08-31T21:40:57+00:00" + }, + { + "name": "google/proto-client", + "version": "0.23.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/proto-client-php.git", + "reference": "b159f408b6acdba55bf727c3639d03bb0117fc27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/proto-client-php/zipball/b159f408b6acdba55bf727c3639d03bb0117fc27", + "reference": "b159f408b6acdba55bf727c3639d03bb0117fc27", + "shasum": "" + }, + "require": { + "google/protobuf": "^3.3.2", + "php": ">=5.5" + }, + "require-dev": { + "google/gax": ">=0.20.0", + "phpunit/phpunit": "4.8.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\": "src/Google/", + "GPBMetadata\\": "src/GPBMetadata/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Generated proto and gRPC classes for Google Cloud Platform in PHP", + "homepage": "https://github.com/googleapis/proto-client-php", + "keywords": [ + "google" + ], + "time": "2017-09-01T22:33:04+00:00" + }, + { + "name": "google/protobuf", + "version": "v3.4.1", + "source": { + "type": "git", + "url": "https://github.com/google/protobuf.git", + "reference": "b04e5cba356212e4e8c66c61bbe0c3a20537c5b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/protobuf/zipball/b04e5cba356212e4e8c66c61bbe0c3a20537c5b9", + "reference": "b04e5cba356212e4e8c66c61bbe0c3a20537c5b9", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "php/src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "proto library for PHP", + "homepage": "https://developers.google.com/protocol-buffers/", + "keywords": [ + "proto" + ], + "time": "2017-09-14T19:24:28+00:00" + }, + { + "name": "grpc/grpc", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/grpc/grpc-php.git", + "reference": "8d190d91ddb9d980f685d9caf79bca62d7edc1e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/8d190d91ddb9d980f685d9caf79bca62d7edc1e6", + "reference": "8d190d91ddb9d980f685d9caf79bca62d7edc1e6", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "google/auth": "v0.9" + }, + "suggest": { + "ext-protobuf": "For better performance, install the protobuf C extension.", + "google/protobuf": "To get started using grpc quickly, install the native protobuf library." + }, + "type": "library", + "autoload": { + "psr-4": { + "Grpc\\": "src/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "gRPC library for PHP", + "homepage": "https://grpc.io", + "keywords": [ + "rpc" + ], + "time": "2017-09-11T20:50:39+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "6.2.3", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "shasum": "" }, "require": { @@ -207,9 +377,12 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", + "phpunit/phpunit": "^4.0 || ^5.0", "psr/log": "^1.0" }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, "type": "library", "extra": { "branch-alias": { @@ -246,7 +419,7 @@ "rest", "web service" ], - "time": "2017-02-28T22:50:30+00:00" + "time": "2017-06-22T18:50:49+00:00" }, { "name": "guzzlehttp/promises", @@ -366,16 +539,16 @@ }, { "name": "monolog/monolog", - "version": "1.22.1", + "version": "1.23.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", "shasum": "" }, "require": { @@ -396,7 +569,7 @@ "phpunit/phpunit-mock-objects": "2.3.0", "ruflin/elastica": ">=0.90 <3.0", "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "~5.3" + "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -440,7 +613,7 @@ "logging", "psr-3" ], - "time": "2017-03-13T07:08:03+00:00" + "time": "2017-06-19T01:22:40+00:00" }, { "name": "psr/cache", @@ -587,16 +760,16 @@ }, { "name": "rize/uri-template", - "version": "0.3.1", + "version": "0.3.2", "source": { "type": "git", "url": "https://github.com/rize/UriTemplate.git", - "reference": "35cee84ae1c4fe0a6599392d7ca13977ff664bee" + "reference": "9e5fdd5c47147aa5adf7f760002ee591ed37b9ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/35cee84ae1c4fe0a6599392d7ca13977ff664bee", - "reference": "35cee84ae1c4fe0a6599392d7ca13977ff664bee", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/9e5fdd5c47147aa5adf7f760002ee591ed37b9ca", + "reference": "9e5fdd5c47147aa5adf7f760002ee591ed37b9ca", "shasum": "" }, "require": { @@ -627,24 +800,24 @@ "template", "uri" ], - "time": "2017-02-21T15:25:22+00:00" + "time": "2017-06-14T03:57:53+00:00" }, { "name": "symfony/console", - "version": "v3.3.0", + "version": "v3.3.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c80e63f3f5e3a331bfc25e6e9332b10422eb9b05" + "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c80e63f3f5e3a331bfc25e6e9332b10422eb9b05", - "reference": "c80e63f3f5e3a331bfc25e6e9332b10422eb9b05", + "url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", + "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, @@ -653,10 +826,10 @@ }, "require-dev": { "psr/log": "~1.0", + "symfony/config": "~3.3", "symfony/dependency-injection": "~3.3", "symfony/event-dispatcher": "~2.8|~3.0", "symfony/filesystem": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { @@ -695,24 +868,24 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-05-28T14:08:56+00:00" + "time": "2017-09-06T16:40:18+00:00" }, { "name": "symfony/debug", - "version": "v3.3.0", + "version": "v3.3.9", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "ef5f19a7a68075a0bd05969a329ead3b0776fb7a" + "reference": "8beb24eec70b345c313640962df933499373a944" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/ef5f19a7a68075a0bd05969a329ead3b0776fb7a", - "reference": "ef5f19a7a68075a0bd05969a329ead3b0776fb7a", + "url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944", + "reference": "8beb24eec70b345c313640962df933499373a944", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { @@ -751,20 +924,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-05-27T16:02:27+00:00" + "time": "2017-09-01T13:23:39+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", "shasum": "" }, "require": { @@ -776,7 +949,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -810,7 +983,7 @@ "portable", "shim" ], - "time": "2016-11-14T01:06:16+00:00" + "time": "2017-06-14T15:44:48+00:00" } ], "packages-dev": [ @@ -920,16 +1093,16 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -970,26 +1143,26 @@ "reflection", "static analysis" ], - "time": "2015-12-27T11:43:31+00:00" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", "shasum": "" }, "require": { "php": ">=5.5", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "phpdocumentor/type-resolver": "^0.3.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -1015,24 +1188,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2017-08-08T06:39:58+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -1062,26 +1235,26 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "time": "2017-06-03T08:32:36+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "v1.7.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "sebastian/comparator": "^1.1|^2.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -1092,7 +1265,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -1125,7 +1298,7 @@ "spy", "stub" ], - "time": "2017-03-02T20:05:34+00:00" + "time": "2017-09-04T11:05:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1377,16 +1550,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.35", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -1445,7 +1618,7 @@ "testing", "xunit" ], - "time": "2017-02-06T05:18:07+00:00" + "time": "2017-06-21T08:07:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1877,20 +2050,20 @@ }, { "name": "symfony/browser-kit", - "version": "v3.3.0", + "version": "v3.3.9", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1" + "reference": "aee7120b058c268363e606ff5fe8271da849a1b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/aee7120b058c268363e606ff5fe8271da849a1b5", + "reference": "aee7120b058c268363e606ff5fe8271da849a1b5", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/dom-crawler": "~2.8|~3.0" }, "require-dev": { @@ -1930,24 +2103,24 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:14:56+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.3.0", + "version": "v3.3.9", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1" + "reference": "6b511d7329b203a620f09a2288818d27dcc915ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", - "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6b511d7329b203a620f09a2288818d27dcc915ae", + "reference": "6b511d7329b203a620f09a2288818d27dcc915ae", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { @@ -1986,24 +2159,24 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-05-25T23:10:31+00:00" + "time": "2017-09-11T15:55:22+00:00" }, { "name": "symfony/process", - "version": "v3.3.0", + "version": "v3.3.9", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf" + "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", + "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { @@ -2035,24 +2208,24 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-22T12:32:03+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "symfony/yaml", - "version": "v3.3.0", + "version": "v3.3.9", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "885db865f6b2b918404a1fae28f9ac640f71f994" + "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/885db865f6b2b918404a1fae28f9ac640f71f994", - "reference": "885db865f6b2b918404a1fae28f9ac640f71f994", + "url": "https://api.github.com/repos/symfony/yaml/zipball/1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "require-dev": { "symfony/console": "~2.8|~3.0" @@ -2090,7 +2263,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-28T10:56:20+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "webmozart/assert", diff --git a/logging/api/logging.php b/logging/api/logging.php index 78d205ac9f..db5b658a31 100644 --- a/logging/api/logging.php +++ b/logging/api/logging.php @@ -1,13 +1,12 @@ -#!/usr/bin/env php add(new Command('create-sink')) + ->setDefinition($inputDefinition) + ->setDescription('Creates a Logging sink') + ->addOption('sink', + null, + InputOption::VALUE_OPTIONAL, + 'The name of the Logging sink', + 'my_sink' + )->addOption( + 'bucket', + null, + InputOption::VALUE_REQUIRED, + 'The destination bucket name' + )->addOption( + 'filter', + null, + InputOption::VALUE_OPTIONAL, + 'The filter expression for the sink', + '' + )->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $sinkName = $input->getOption('sink'); + $loggerName = $input->getOption('logger'); + $filter = $input->getOption('filter'); + $bucketName = $input->getOption('bucket'); + $destination = sprintf( + 'storage.googleapis.com/%s', + $bucketName + ); + $loggerFullName = sprintf( + 'projects/%s/logs/%s', + $projectId, + $loggerName + ); + $filterString = sprintf('logName = "%s"', $loggerFullName); + if (!empty($filter)) { + $filterString .= ' AND ' . $filter; + } + create_sink($projectId, $sinkName, $destination, $filterString); + }); + +$application->add(new Command('delete-logger')) + ->setDefinition($inputDefinition) + ->setDescription('Deletes the given logger and its entries') + ->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $loggerName = $input->getOption('logger'); + delete_logger($projectId, $loggerName); + }); + +$application->add(new Command('delete-sink')) + ->setDefinition($inputDefinition) + ->setDescription('Deletes a Logging sink') + ->addOption( + 'sink', + null, + InputOption::VALUE_OPTIONAL, + 'The name of the Logging sink', + 'my_sink' + )->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $sinkName = $input->getOption('sink'); + delete_sink($projectId, $sinkName); + }); + +$application->add(new Command('list-entries')) + ->setDefinition($inputDefinition) + ->setDescription('Lists log entries in the logger') + ->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $loggerName = $input->getOption('logger'); + $entries = list_entries($projectId, $loggerName); + }); + +$application->add(new Command('list-sinks')) + ->setDefinition($inputDefinition) + ->setDescription('Lists sinks') + ->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $sinks = list_sinks($projectId); + }); + +$application->add(new Command('update-sink')) + ->setDefinition($inputDefinition) + ->setDescription('Updates a Logging sink') + ->addOption( + 'sink', + null, + InputOption::VALUE_OPTIONAL, + 'The name of the Logging sink', + 'my_sink' + )->addOption( + 'filter', + null, + InputOption::VALUE_OPTIONAL, + 'The filter expression for the sink', + '' + )->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $sinkName = $input->getOption('sink'); + $loggerName = $input->getOption('logger'); + $filter = $input->getOption('filter'); + $loggerFullName = sprintf( + 'projects/%s/logs/%s', + $projectId, + $loggerName + ); + $filterString = sprintf('logName = "%s"', $loggerFullName); + if (!empty($filter)) { + $filterString .= ' AND ' . $filter; + } + update_sink($projectId, $sinkName, $filterString); + }); + +$application->add(new Command('write')) + ->setDefinition($inputDefinition) + ->setDescription('Writes log entries to the given logger') + ->addArgument( + "message", + InputArgument::OPTIONAL, + "The log message to write", + "Hello" + ) + ->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $message = $input->getArgument('message'); + $loggerName = $input->getOption('logger'); + write_log($projectId, $loggerName, $message); + }); + +// for testing +if (getenv('PHPUNIT_TESTS') === '1') { + return $application; +} -$application = new Application(); -$application->add(new CreateSinkCommand()); -$application->add(new DeleteLoggerCommand()); -$application->add(new DeleteSinkCommand()); -$application->add(new ListEntriesCommand()); -$application->add(new ListSinksCommand()); -$application->add(new UpdateSinkCommand()); -$application->add(new WriteCommand()); $application->run(); diff --git a/logging/api/phpunit.xml.dist b/logging/api/phpunit.xml.dist index 2af2b09570..54b7be5557 100644 --- a/logging/api/phpunit.xml.dist +++ b/logging/api/phpunit.xml.dist @@ -28,4 +28,7 @@ ./src + + + diff --git a/logging/api/src/BaseCommand.php b/logging/api/src/BaseCommand.php deleted file mode 100644 index c52ecde985..0000000000 --- a/logging/api/src/BaseCommand.php +++ /dev/null @@ -1,78 +0,0 @@ -addOption( - 'project', - null, - InputOption::VALUE_REQUIRED, - 'The Google Cloud Platform project name to use for this command. ' . - 'If omitted then the current gcloud project is assumed. ', - $this->getProjectIdFromGcloud() - ); - $this->addOption( - 'logger', - null, - InputOption::VALUE_OPTIONAL, - 'The name of the logger. By naming a logger, you can logically ' - . 'treat log entries in a logger; e.g. you can list or delete ' - . 'all the log entries by the name of the logger.', - 'my_logger' - ); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - if (empty($input->getOption("project"))) { - throw new \Exception("Project ID not specified"); - } - } - - /** - * Detect the current project id configured by gcloud sdk. - * - * @return string|null detected projectId or null upon failure - */ - private function getProjectIdFromGcloud() - { - exec( - "gcloud config list --format 'value(core.project)' 2>/dev/null", - $output, - $return_var - ); - if (0 === $return_var) { - return array_pop($output); - } - return null; - } -} diff --git a/logging/api/src/CreateSinkCommand.php b/logging/api/src/CreateSinkCommand.php deleted file mode 100644 index fcff45f889..0000000000 --- a/logging/api/src/CreateSinkCommand.php +++ /dev/null @@ -1,82 +0,0 @@ -setName('create-sink') - ->setDescription('Creates a Logging sink') - ->addOption( - 'sink', - null, - InputOption::VALUE_OPTIONAL, - 'The name of the Logging sink', - 'my_sink' - ) - ->addOption( - 'bucket', - null, - InputOption::VALUE_REQUIRED, - 'The destination bucket name' - )->addOption( - 'filter', - null, - InputOption::VALUE_OPTIONAL, - 'The filter expression for the sink', - '' - ); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $sinkName = $input->getOption('sink'); - $projectId = $input->getOption('project'); - $loggerName = $input->getOption('logger'); - $filter = $input->getOption('filter'); - $bucketName = $input->getOption('bucket'); - $destination = sprintf( - 'storage.googleapis.com/%s', - $bucketName - ); - $loggerFullName = sprintf( - 'projects/%s/logs/%s', - $projectId, - $loggerName - ); - $filterString = sprintf('logName = "%s"', $loggerFullName); - if (!empty($filter)) { - $filterString .= ' AND ' . $filter; - } - create_sink($projectId, $sinkName, $destination, $filterString); - printf("Created a sink '%s'." . PHP_EOL, $sinkName); - } -} diff --git a/logging/api/src/DeleteLoggerCommand.php b/logging/api/src/DeleteLoggerCommand.php deleted file mode 100644 index bffdf8306c..0000000000 --- a/logging/api/src/DeleteLoggerCommand.php +++ /dev/null @@ -1,46 +0,0 @@ -setName('delete-logger') - ->setDescription('Deletes the given logger and its entries'); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $projectId = $input->getOption('project'); - $loggerName = $input->getOption('logger'); - delete_logger($projectId, $loggerName); - printf("Deleted a logger '%s'." . PHP_EOL, $loggerName); - } -} diff --git a/logging/api/src/DeleteSinkCommand.php b/logging/api/src/DeleteSinkCommand.php deleted file mode 100644 index e402a44911..0000000000 --- a/logging/api/src/DeleteSinkCommand.php +++ /dev/null @@ -1,54 +0,0 @@ -setName('delete-sink') - ->setDescription('Deletes a Logging sink') - ->addOption( - 'sink', - null, - InputOption::VALUE_OPTIONAL, - 'The name of the Logging sink', - 'my_sink' - ); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $sinkName = $input->getOption('sink'); - $projectId = $input->getOption('project'); - delete_sink($projectId, $sinkName); - printf("Deleted a sink '%s'." . PHP_EOL, $sinkName); - } -} diff --git a/logging/api/src/ListEntriesCommand.php b/logging/api/src/ListEntriesCommand.php deleted file mode 100644 index 60e9db1e9e..0000000000 --- a/logging/api/src/ListEntriesCommand.php +++ /dev/null @@ -1,68 +0,0 @@ -setName('list-entries') - ->setDescription('Lists log entries in the logger'); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $projectId = $input->getOption('project'); - $loggerName = $input->getOption('logger'); - $entries = list_entries($projectId, $loggerName); - foreach ($entries as $entry) { - /* @var $entry \Google\Cloud\Logging\Entry */ - $entryInfo = $entry->info(); - if (isset($entryInfo['textPayload'])) { - $entryText = $entryInfo['textPayload']; - } else { - $entryText = $this->formatJsonPayload($entryInfo['jsonPayload']); - } - printf( - "%s : %s" . PHP_EOL, - $entryInfo['timestamp'], - $entryText - ); - } - } - - private function formatJsonPayload(array $jsonPayload) - { - $entryPayload = []; - foreach ($jsonPayload as $key => $value) { - $entryPayload[] = "$key=$value"; - } - return '{' . implode(', ', $entryPayload) . '}'; - } -} diff --git a/logging/api/src/ListSinksCommand.php b/logging/api/src/ListSinksCommand.php deleted file mode 100644 index 1768dad3b4..0000000000 --- a/logging/api/src/ListSinksCommand.php +++ /dev/null @@ -1,51 +0,0 @@ -setName('list-sinks') - ->setDescription('Lists sinks'); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $projectId = $input->getOption('project'); - $sinks = list_sinks($projectId); - foreach ($sinks as $sink) { - /* @var $sink \Google\Cloud\Logging\Sink */ - foreach ($sink->info() as $key => $value) { - print "$key:$value\n"; - } - print PHP_EOL; - } - } -} diff --git a/logging/api/src/UpdateSinkCommand.php b/logging/api/src/UpdateSinkCommand.php deleted file mode 100644 index 1c1bbf8774..0000000000 --- a/logging/api/src/UpdateSinkCommand.php +++ /dev/null @@ -1,71 +0,0 @@ -setName('update-sink') - ->setDescription('Updates a Logging sink') - ->addOption( - 'sink', - null, - InputOption::VALUE_OPTIONAL, - 'The name of the Logging sink', - 'my_sink' - )->addOption( - 'filter', - null, - InputOption::VALUE_OPTIONAL, - 'The filter expression for the sink', - '' - ); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $sinkName = $input->getOption('sink'); - $projectId = $input->getOption('project'); - $loggerName = $input->getOption('logger'); - $filter = $input->getOption('filter'); - $loggerFullName = sprintf( - 'projects/%s/logs/%s', - $projectId, - $loggerName - ); - $filterString = sprintf('logName = "%s"', $loggerFullName); - if (!empty($filter)) { - $filterString .= ' AND ' . $filter; - } - update_sink($projectId, $sinkName, $filterString); - printf("Updated a sink '%s'." . PHP_EOL, $sinkName); - } -} diff --git a/logging/api/src/WriteCommand.php b/logging/api/src/WriteCommand.php deleted file mode 100644 index 7569e5c8fa..0000000000 --- a/logging/api/src/WriteCommand.php +++ /dev/null @@ -1,54 +0,0 @@ -setName('write') - ->setDescription('Writes log entries to the given logger') - ->addArgument( - "message", - InputArgument::OPTIONAL, - "The log message to write", - "Hello" - ); - $this->addCommonOptions(); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $message = $input->getArgument('message'); - $projectId = $input->getOption('project'); - $loggerName = $input->getOption('logger'); - write_log($projectId, $loggerName, $message); - printf("Wrote a log to a logger '%s'." . PHP_EOL, $loggerName); - } -} diff --git a/logging/api/src/functions/log_entry_functions.php b/logging/api/src/log_entry_functions.php similarity index 76% rename from logging/api/src/functions/log_entry_functions.php rename to logging/api/src/log_entry_functions.php index d783eb9853..b516821e25 100644 --- a/logging/api/src/functions/log_entry_functions.php +++ b/logging/api/src/log_entry_functions.php @@ -43,6 +43,7 @@ function write_log($projectId, $loggerName, $message) ]); $entry = $logger->entry($message); $logger->write($entry); + printf("Wrote a log to a logger '%s'." . PHP_EOL, $loggerName); } // [END write_log] @@ -66,7 +67,23 @@ function list_entries($projectId, $loggerName) $options = [ 'filter' => $filter, ]; - return $logging->entries($options); + $entries = $logging->entries($options); + + // Print the entries + foreach ($entries as $entry) { + /* @var $entry \Google\Cloud\Logging\Entry */ + $entryInfo = $entry->info(); + if (isset($entryInfo['textPayload'])) { + $entryText = $entryInfo['textPayload']; + } else { + $entryPayload = []; + foreach ($jsonPayload as $key => $value) { + $entryPayload[] = "$key=$value"; + } + $entryText = '{' . implode(', ', $entryPayload) . '}'; + } + printf("%s : %s" . PHP_EOL, $entryInfo['timestamp'], $entryText); + } } // [END list_entries] @@ -81,5 +98,6 @@ function delete_logger($projectId, $loggerName) $logging = new LoggingClient(['projectId' => $projectId]); $logger = $logging->logger($loggerName); $logger->delete(); + printf("Deleted a logger '%s'." . PHP_EOL, $loggerName); } // [END delete_logger] diff --git a/logging/api/src/functions/sink_functions.php b/logging/api/src/sink_functions.php similarity index 84% rename from logging/api/src/functions/sink_functions.php rename to logging/api/src/sink_functions.php index 210551b60d..2a9da6fc2f 100644 --- a/logging/api/src/functions/sink_functions.php +++ b/logging/api/src/sink_functions.php @@ -39,6 +39,7 @@ function create_sink($projectId, $sinkName, $destination, $filterString) $destination, ['filter' => $filterString] ); + printf("Created a sink '%s'." . PHP_EOL, $sinkName); } // [END create_sink] @@ -52,6 +53,7 @@ function delete_sink($projectId, $sinkName) { $logging = new LoggingClient(['projectId' => $projectId]); $logging->sink($sinkName)->delete(); + printf("Deleted a sink '%s'." . PHP_EOL, $sinkName); } // [END delete_sink] @@ -65,7 +67,14 @@ function delete_sink($projectId, $sinkName) function list_sinks($projectId) { $logging = new LoggingClient(['projectId' => $projectId]); - return $logging->sinks(); + $sinks = $logging->sinks(); + foreach ($sinks as $sink) { + /* @var $sink \Google\Cloud\Logging\Sink */ + foreach ($sink->info() as $key => $value) { + print "$key:$value\n"; + } + print PHP_EOL; + } } // [END list_sinks] @@ -83,5 +92,6 @@ function update_sink($projectId, $sinkName, $filterString) $logging = new LoggingClient(['projectId' => $projectId]); $sink = $logging->sink($sinkName); $sink->update(['filter' => $filterString]); + printf("Updated a sink '%s'." . PHP_EOL, $sinkName); } // [END update_sink] diff --git a/logging/api/test/CreateSinkCommandTest.php b/logging/api/test/CreateSinkCommandTest.php deleted file mode 100644 index b0737b93dc..0000000000 --- a/logging/api/test/CreateSinkCommandTest.php +++ /dev/null @@ -1,93 +0,0 @@ - 0; - self::$sinkName = sprintf("sink-%s", uniqid()); - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - } - - public function tearDown() - { - // Clean up the sink after the test - $application = new Application(); - $application->add(new DeleteSinkCommand()); - $commandTester = new CommandTester($application->get('delete-sink')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - } - - public function testCreateSink() - { - if (!$bucket = getenv('GOOGLE_BUCKET_NAME')) { - $this->markTestSkipped('No GOOGLE_BUCKET_NAME envvar'); - } - $application = new Application(); - $application->add(new CreateSinkCommand()); - $commandTester = new CommandTester($application->get('create-sink')); - $loggerName = 'my_test_logger'; - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => $loggerName, - '--bucket' => $bucket, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/Created a sink '%s'./", self::$sinkName) - ); - } -} diff --git a/logging/api/test/DeleteLoggerCommandTest.php b/logging/api/test/DeleteLoggerCommandTest.php deleted file mode 100644 index a1f316ef8c..0000000000 --- a/logging/api/test/DeleteLoggerCommandTest.php +++ /dev/null @@ -1,78 +0,0 @@ - 0; - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - $application = new Application(); - $application->add(new WriteCommand()); - $commandTester = new CommandTester($application->get('write')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => 'my_test_logger', - 'message' => 'Test Message' - ], - ['interactive' => false] - ); - sleep(2); - } - - public function testDeleteLogger() - { - $application = new Application(); - $application->add(new DeleteLoggerCommand()); - $commandTester = new CommandTester($application->get('delete-logger')); - $commandTester->execute( - ['--project' => $this->projectId, '--logger' => 'my_test_logger'], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/Deleted a logger '%s'./", 'my_test_logger') - ); - } -} diff --git a/logging/api/test/DeleteSinkCommandTest.php b/logging/api/test/DeleteSinkCommandTest.php deleted file mode 100644 index 075be3f2fa..0000000000 --- a/logging/api/test/DeleteSinkCommandTest.php +++ /dev/null @@ -1,88 +0,0 @@ - 0; - self::$sinkName = sprintf("sink-%s", uniqid()); - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - if (!$bucket = getenv('GOOGLE_BUCKET_NAME')) { - $this->markTestSkipped('No GOOGLE_BUCKET_NAME envvar'); - } - $application = new Application(); - $application->add(new CreateSinkCommand()); - $commandTester = new CommandTester($application->get('create-sink')); - $loggerName = 'my_test_logger'; - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => $loggerName, - '--bucket' => $bucket, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - } - - public function testDeleteSink() - { - $application = new Application(); - $application->add(new DeleteSinkCommand()); - $commandTester = new CommandTester($application->get('delete-sink')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/Deleted a sink '%s'./", self::$sinkName) - ); - } -} diff --git a/logging/api/test/ListEntriesCommandTest.php b/logging/api/test/ListEntriesCommandTest.php deleted file mode 100644 index 02930026d8..0000000000 --- a/logging/api/test/ListEntriesCommandTest.php +++ /dev/null @@ -1,89 +0,0 @@ - 0; - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - - // up the default retry count - $this->eventuallyConsistentRetryCount = 5; - } - - public function testListEntries() - { - $application = new Application(); - $application->add(new WriteCommand()); - $application->add(new ListEntriesCommand()); - - $writeCommandTester = new CommandTester($application->get('write')); - $writeCommandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => 'my_test_logger', - 'message' => 'Test Message' - ], - ['interactive' => false] - ); - - $commandTester = new CommandTester($application->get('list-entries')); - $this->runEventuallyConsistentTest(function () use ($commandTester) { - ob_start(); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => 'my_test_logger' - ], - ['interactive' => false] - ); - $output = ob_get_clean(); - $this->assertRegexp('/: Test Message/', $output); - }, 10); - } -} diff --git a/logging/api/test/ListSinksCommandTest.php b/logging/api/test/ListSinksCommandTest.php deleted file mode 100644 index 3fa5715531..0000000000 --- a/logging/api/test/ListSinksCommandTest.php +++ /dev/null @@ -1,103 +0,0 @@ - 0; - self::$sinkName = sprintf("sink-%s", uniqid()); - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - if (!$bucket = getenv('GOOGLE_BUCKET_NAME')) { - $this->markTestSkipped('No GOOGLE_BUCKET_NAME envvar'); - } - $application = new Application(); - $application->add(new CreateSinkCommand()); - $commandTester = new CommandTester($application->get('create-sink')); - $loggerName = 'my_test_logger'; - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => $loggerName, - '--bucket' => $bucket, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - } - - public function tearDown() - { - // Clean up the sink after the test - $application = new Application(); - $application->add(new DeleteSinkCommand()); - $commandTester = new CommandTester($application->get('delete-sink')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - } - - public function testListSinks() - { - $application = new Application(); - $application->add(new ListSinksCommand()); - $commandTester = new CommandTester($application->get('list-sinks')); - $commandTester->execute( - [ - '--project' => $this->projectId, - ], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/name:%s/", self::$sinkName) - ); - } -} diff --git a/logging/api/test/UpdateSinkCommandTest.php b/logging/api/test/UpdateSinkCommandTest.php deleted file mode 100644 index b3443258c4..0000000000 --- a/logging/api/test/UpdateSinkCommandTest.php +++ /dev/null @@ -1,140 +0,0 @@ - 0; - self::$sinkName = sprintf("sink-%s", uniqid()); - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - if (!$bucket = getenv('GOOGLE_BUCKET_NAME')) { - $this->markTestSkipped('No GOOGLE_BUCKET_NAME envvar'); - } - $application = new Application(); - $application->add(new CreateSinkCommand()); - $commandTester = new CommandTester($application->get('create-sink')); - $loggerName = 'my_test_logger'; - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => $loggerName, - '--bucket' => $bucket, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - } - - public function tearDown() - { - // Clean up the sink after the test - $application = new Application(); - $application->add(new DeleteSinkCommand()); - $commandTester = new CommandTester($application->get('delete-sink')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--sink' => self::$sinkName, - ], - ['interactive' => false] - ); - } - - public function testUpdateSink() - { - $application = new Application(); - $application->add(new UpdateSinkCommand()); - $commandTester = new CommandTester($application->get('update-sink')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--sink' => self::$sinkName, - '--logger' => 'updated-logger', - ], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/Updated a sink '%s'./", self::$sinkName) - ); - // Check the updated filter value - $logging = new LoggingClient(['projectId' => $this->projectId]); - $sink = $logging->sink(self::$sinkName); - $sink->reload(); - $this->assertRegExp( - sprintf( - '|projects/%s/logs/%s|', - $this->projectId, - 'updated-logger' - ), - $sink->info['filter']); - } - - public function testUpdateSinkWithFilter() - { - $application = new Application(); - $application->add(new UpdateSinkCommand()); - $commandTester = new CommandTester($application->get('update-sink')); - $commandTester->execute( - [ - '--project' => $this->projectId, - '--sink' => self::$sinkName, - '--filter' => 'severity >= INFO', - ], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/Updated a sink '%s'./", self::$sinkName) - ); - // Check the updated filter value - $logging = new LoggingClient(['projectId' => $this->projectId]); - $sink = $logging->sink(self::$sinkName); - $sink->reload(); - $this->assertRegExp('/severity >= INFO/', $sink->info['filter']); - } -} diff --git a/logging/api/test/WriteCommandTest.php b/logging/api/test/WriteCommandTest.php deleted file mode 100644 index 7626690ea4..0000000000 --- a/logging/api/test/WriteCommandTest.php +++ /dev/null @@ -1,71 +0,0 @@ - 0; - } - - public function setUp() - { - if (!self::$hasCredentials) { - $this->markTestSkipped('No application credentials were found.'); - } - - if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { - $this->markTestSkipped('No project ID'); - } - } - - public function testWrite() - { - $application = new Application(); - $application->add(new WriteCommand()); - $commandTester = new CommandTester($application->get('write')); - $loggerName = 'my_test_logger'; - $message = 'Test Message'; - $commandTester->execute( - [ - '--project' => $this->projectId, - '--logger' => $loggerName, - 'message' => $message - ], - ['interactive' => false] - ); - $this->expectOutputRegex( - sprintf("/Wrote a log to a logger '%s'./", $loggerName) - ); - } -} diff --git a/logging/api/test/loggingTest.php b/logging/api/test/loggingTest.php new file mode 100644 index 0000000000..d9a10ec58d --- /dev/null +++ b/logging/api/test/loggingTest.php @@ -0,0 +1,202 @@ + 0; + self::$loggerName = 'my_test_logger'; + self::$sinkName = sprintf("sink-%s", uniqid()); + } + + public function setUp() + { + if (!self::$hasCredentials) { + $this->markTestSkipped('No application credentials were found.'); + } + + if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { + $this->markTestSkipped('No project ID'); + } + } + + public function testCreateSink() + { + if (!$bucket = getenv('GOOGLE_BUCKET_NAME')) { + $this->markTestSkipped('No GOOGLE_BUCKET_NAME envvar'); + } + + $output = $this->runCommand('create-sink', [ + '--logger' => self::$loggerName, + '--bucket' => $bucket, + '--sink' => self::$sinkName, + ]); + $this->assertEquals( + sprintf("Created a sink '%s'.\n", self::$sinkName), + $output + ); + } + + /** + * @depends testCreateSink + */ + public function testListSinks() + { + $output = $this->runCommand('list-sinks'); + $this->assertContains('name:' . self::$sinkName, $output); + } + + /** + * @depends testCreateSink + */ + public function testUpdateSink() + { + $output = $this->runCommand('update-sink', [ + '--sink' => self::$sinkName, + '--logger' => 'updated-logger', + ]); + $this->assertEquals( + sprintf("Updated a sink '%s'.\n", self::$sinkName), + $output + ); + // Check the updated filter value + $logging = new LoggingClient(['projectId' => $this->projectId]); + $sink = $logging->sink(self::$sinkName); + $sink->reload(); + $this->assertRegExp( + sprintf( + '|projects/%s/logs/%s|', + $this->projectId, + 'updated-logger' + ), + $sink->info['filter'] + ); + } + + /** + * @depends testCreateSink + */ + public function testUpdateSinkWithFilter() + { + $output = $this->runCommand('update-sink', [ + '--sink' => self::$sinkName, + '--filter' => 'severity >= INFO', + ]); + $this->assertEquals( + sprintf("Updated a sink '%s'.\n", self::$sinkName), + $output + ); + // Check the updated filter value + $logging = new LoggingClient(['projectId' => $this->projectId]); + $sink = $logging->sink(self::$sinkName); + $sink->reload(); + $this->assertRegExp('/severity >= INFO/', $sink->info['filter']); + } + + /** + * @depends testCreateSink + */ + public function testDeleteSink() + { + $output = $this->runCommand('delete-sink', [ + // '--logger' => self::$loggerName, + '--sink' => self::$sinkName, + ]); + $this->assertEquals( + sprintf("Deleted a sink '%s'.\n", self::$sinkName), + $output + ); + } + + public function testWrite() + { + $message = 'Test Message'; + $output = $this->runCommand('write', [ + '--logger' => self::$loggerName, + 'message' => $message + ]); + $this->assertEquals( + sprintf("Wrote a log to a logger '%s'.\n", self::$loggerName), + $output + ); + } + + /** + * @depends testWrite + */ + public function testListEntries() + { + $phpunit = $this; + $loggerName = self::$loggerName; + $this->runEventuallyConsistentTest(function () use ($phpunit, $loggerName) { + $output = $phpunit->runCommand('list-entries', [ + '--logger' => $loggerName, + ]); + $this->assertContains(': Test Message', $output); + }, 10); + } + + public function testDeleteLogger() + { + $output = $this->runCommand('delete-logger', [ + '--logger' => self::$loggerName, + ]); + $this->assertEquals( + sprintf("Deleted a logger '%s'.\n", self::$loggerName), + $output + ); + } + + public function runCommand($commandName, $additionalArgs = []) + { + $application = require __DIR__ . '/../logging.php'; + $command = $application->get($commandName); + $commandTester = new CommandTester($command); + + ob_start(); + $commandTester->execute([ + 'project' => $this->projectId, + ] + $additionalArgs, [ + 'interactive' => false + ]); + + return ob_get_clean(); + } +} From aff6405aae156de2f9da99476c8f4cad96099393 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 22 Sep 2017 18:08:50 -0700 Subject: [PATCH 2/7] consolidates logging API and quickstart directories --- logging/{api => }/README.md | 0 logging/{api => }/composer.json | 0 logging/{api => }/composer.lock | 0 logging/{api => }/logging.php | 0 logging/{api => }/phpunit.xml.dist | 0 logging/{quickstart => }/quickstart.php | 0 logging/quickstart/composer.json | 9 - logging/quickstart/composer.lock | 1760 ----------------- logging/quickstart/phpunit.xml.dist | 31 - logging/{api => }/src/log_entry_functions.php | 0 logging/{api => }/src/sink_functions.php | 0 logging/{api => }/test/loggingTest.php | 3 + .../{quickstart => }/test/quickstartTest.php | 1 + 13 files changed, 4 insertions(+), 1800 deletions(-) rename logging/{api => }/README.md (100%) rename logging/{api => }/composer.json (100%) rename logging/{api => }/composer.lock (100%) rename logging/{api => }/logging.php (100%) rename logging/{api => }/phpunit.xml.dist (100%) rename logging/{quickstart => }/quickstart.php (100%) delete mode 100644 logging/quickstart/composer.json delete mode 100644 logging/quickstart/composer.lock delete mode 100644 logging/quickstart/phpunit.xml.dist rename logging/{api => }/src/log_entry_functions.php (100%) rename logging/{api => }/src/sink_functions.php (100%) rename logging/{api => }/test/loggingTest.php (99%) rename logging/{quickstart => }/test/quickstartTest.php (96%) diff --git a/logging/api/README.md b/logging/README.md similarity index 100% rename from logging/api/README.md rename to logging/README.md diff --git a/logging/api/composer.json b/logging/composer.json similarity index 100% rename from logging/api/composer.json rename to logging/composer.json diff --git a/logging/api/composer.lock b/logging/composer.lock similarity index 100% rename from logging/api/composer.lock rename to logging/composer.lock diff --git a/logging/api/logging.php b/logging/logging.php similarity index 100% rename from logging/api/logging.php rename to logging/logging.php diff --git a/logging/api/phpunit.xml.dist b/logging/phpunit.xml.dist similarity index 100% rename from logging/api/phpunit.xml.dist rename to logging/phpunit.xml.dist diff --git a/logging/quickstart/quickstart.php b/logging/quickstart.php similarity index 100% rename from logging/quickstart/quickstart.php rename to logging/quickstart.php diff --git a/logging/quickstart/composer.json b/logging/quickstart/composer.json deleted file mode 100644 index 6ff2235dcd..0000000000 --- a/logging/quickstart/composer.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "require": { - "php": ">=5.4", - "google/cloud-logging": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4" - } -} diff --git a/logging/quickstart/composer.lock b/logging/quickstart/composer.lock deleted file mode 100644 index 9f7ec0afcf..0000000000 --- a/logging/quickstart/composer.lock +++ /dev/null @@ -1,1760 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "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": "84333b22b2d827650452d44b40f6a3e9", - "packages": [ - { - "name": "firebase/php-jwt", - "version": "v4.0.0", - "source": { - "type": "git", - "url": "https://github.com/firebase/php-jwt.git", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35", - "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Firebase\\JWT\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Neuman Vong", - "email": "neuman+pear@twilio.com", - "role": "Developer" - }, - { - "name": "Anant Narayanan", - "email": "anant@php.net", - "role": "Developer" - } - ], - "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", - "homepage": "https://github.com/firebase/php-jwt", - "time": "2016-07-18T04:51:16+00:00" - }, - { - "name": "google/auth", - "version": "v0.11.1", - "source": { - "type": "git", - "url": "https://github.com/google/google-auth-library-php.git", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/a240674b08a09949fd5597f7590b3ed83663a12d", - "reference": "a240674b08a09949fd5597f7590b3ed83663a12d", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0", - "guzzlehttp/guzzle": "~5.3|~6.0", - "guzzlehttp/psr7": "~1.2", - "php": ">=5.4", - "psr/cache": "^1.0", - "psr/http-message": "^1.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^1.11", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ], - "psr-4": { - "Google\\Auth\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Google Auth Library for PHP", - "homepage": "http://github.com/google/google-auth-library-php", - "keywords": [ - "Authentication", - "google", - "oauth2" - ], - "time": "2016-11-02T14:59:14+00:00" - }, - { - "name": "google/cloud-core", - "version": "v1.5.1", - "source": { - "type": "git", - "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-core.git", - "reference": "145cc80d8eeb03ad677733ca2a5a9bcf4fc3def9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-core/zipball/145cc80d8eeb03ad677733ca2a5a9bcf4fc3def9", - "reference": "145cc80d8eeb03ad677733ca2a5a9bcf4fc3def9", - "shasum": "" - }, - "require": { - "google/auth": "^0.11", - "guzzlehttp/guzzle": "^5.3|^6.0", - "guzzlehttp/psr7": "^1.2", - "monolog/monolog": "~1", - "php": ">=5.5", - "psr/http-message": "1.0.*", - "rize/uri-template": "~0.3" - }, - "suggest": { - "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" - }, - "type": "library", - "extra": { - "component": { - "id": "cloud-core", - "target": "GoogleCloudPlatform/google-cloud-php-core.git", - "path": "src/Core", - "entry": null - } - }, - "autoload": { - "psr-4": { - "Google\\Cloud\\Core\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", - "time": "2017-05-25T15:15:05+00:00" - }, - { - "name": "google/cloud-logging", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-logging.git", - "reference": "1a5f4a5b2fe418aac23bc7bb962a9a831377233b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-logging/zipball/1a5f4a5b2fe418aac23bc7bb962a9a831377233b", - "reference": "1a5f4a5b2fe418aac23bc7bb962a9a831377233b", - "shasum": "" - }, - "require": { - "google/cloud-core": "^1.0" - }, - "suggest": { - "google/gax": "Required to support gRPC", - "google/proto-client-php": "Required to support gRPC" - }, - "type": "library", - "extra": { - "component": { - "id": "cloud-logging", - "target": "GoogleCloudPlatform/google-cloud-php-logging.git", - "path": "src/Logging", - "entry": "LoggingClient.php" - } - }, - "autoload": { - "psr-4": { - "Google\\Cloud\\Logging\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Stackdriver Logging Client for PHP", - "time": "2017-05-18T15:22:19+00:00" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.2.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "shasum": "" - }, - "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2017-02-28T22:50:30+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2017-03-20T17:10:46+00:00" - }, - { - "name": "monolog/monolog", - "version": "1.22.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", - "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" - }, - "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-03-13T07:08:03+00:00" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "time": "2016-08-06T20:24:11+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "rize/uri-template", - "version": "0.3.1", - "source": { - "type": "git", - "url": "https://github.com/rize/UriTemplate.git", - "reference": "35cee84ae1c4fe0a6599392d7ca13977ff664bee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rize/UriTemplate/zipball/35cee84ae1c4fe0a6599392d7ca13977ff664bee", - "reference": "35cee84ae1c4fe0a6599392d7ca13977ff664bee", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Rize\\UriTemplate": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marut K", - "homepage": "http://twitter.com/rezigned" - } - ], - "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", - "keywords": [ - "RFC 6570", - "template", - "uri" - ], - "time": "2017-02-21T15:25:22+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27T11:43:31+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-03-02T20:05:34+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03T07:40:28+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.11", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-02-27T10:12:30+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.35", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-02-06T05:18:07+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-08-18T05:49:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17T09:04:28+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03T07:41:43+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "885db865f6b2b918404a1fae28f9ac640f71f994" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/885db865f6b2b918404a1fae28f9ac640f71f994", - "reference": "885db865f6b2b918404a1fae28f9ac640f71f994", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-05-28T10:56:20+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.4" - }, - "platform-dev": [] -} diff --git a/logging/quickstart/phpunit.xml.dist b/logging/quickstart/phpunit.xml.dist deleted file mode 100644 index 95219ee94d..0000000000 --- a/logging/quickstart/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - test - - - - - - - - quickstart.php - - - diff --git a/logging/api/src/log_entry_functions.php b/logging/src/log_entry_functions.php similarity index 100% rename from logging/api/src/log_entry_functions.php rename to logging/src/log_entry_functions.php diff --git a/logging/api/src/sink_functions.php b/logging/src/sink_functions.php similarity index 100% rename from logging/api/src/sink_functions.php rename to logging/src/sink_functions.php diff --git a/logging/api/test/loggingTest.php b/logging/test/loggingTest.php similarity index 99% rename from logging/api/test/loggingTest.php rename to logging/test/loggingTest.php index d9a10ec58d..7dc399e3fd 100644 --- a/logging/api/test/loggingTest.php +++ b/logging/test/loggingTest.php @@ -173,6 +173,9 @@ public function testListEntries() }, 10); } + /** + * @depends testWrite + */ public function testDeleteLogger() { $output = $this->runCommand('delete-logger', [ diff --git a/logging/quickstart/test/quickstartTest.php b/logging/test/quickstartTest.php similarity index 96% rename from logging/quickstart/test/quickstartTest.php rename to logging/test/quickstartTest.php index 44f577a81c..2a77e57f34 100644 --- a/logging/quickstart/test/quickstartTest.php +++ b/logging/test/quickstartTest.php @@ -40,5 +40,6 @@ public function testQuickstart() $this->assertEquals('Hello, world!', $info['textPayload']); $this->assertContains('my-log', $info['logName']); $this->assertEquals('global', $info['resource']['type']); + $this->expectOutputString('Logged Hello, world!'); } } From 79338f36180082586d48dcafa90d34ca78614f28 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 22 Sep 2017 18:33:33 -0700 Subject: [PATCH 3/7] adds PSR3 logger example --- logging/composer.json | 4 ++- logging/composer.lock | 2 +- logging/logging.php | 44 ++++++++++++++++++++++------- logging/src/log_entry_functions.php | 2 +- logging/src/psr_logger.php | 37 ++++++++++++++++++++++++ logging/test/loggingTest.php | 14 +++++++++ 6 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 logging/src/psr_logger.php diff --git a/logging/composer.json b/logging/composer.json index 283de084a2..6c9f8a0a22 100644 --- a/logging/composer.json +++ b/logging/composer.json @@ -1,7 +1,8 @@ { "require": { "google/cloud-logging": "^1.0", - "symfony/console": "^3.0" + "symfony/console": "^3.0", + "monolog/monolog": "^1.23" }, "require-dev": { "phpunit/phpunit": "~4.8", @@ -10,6 +11,7 @@ "autoload": { "files": [ "src/log_entry_functions.php", + "src/psr_logger.php", "src/sink_functions.php" ] } diff --git a/logging/composer.lock b/logging/composer.lock index 1172baeabf..a9e438caf7 100644 --- a/logging/composer.lock +++ b/logging/composer.lock @@ -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": "0f5b019e6279532993e47dac6c847958", + "content-hash": "09c8128906b36c8561810b53d65f529a", "packages": [ { "name": "firebase/php-jwt", diff --git a/logging/logging.php b/logging/logging.php index db5b658a31..892e3c1690 100644 --- a/logging/logging.php +++ b/logging/logging.php @@ -47,7 +47,7 @@ // Create Sink command $application->add(new Command('create-sink')) - ->setDefinition($inputDefinition) + ->setDefinition(clone $inputDefinition) ->setDescription('Creates a Logging sink') ->addOption('sink', null, @@ -97,7 +97,7 @@ }); $application->add(new Command('delete-sink')) - ->setDefinition($inputDefinition) + ->setDefinition(clone $inputDefinition) ->setDescription('Deletes a Logging sink') ->addOption( 'sink', @@ -129,7 +129,7 @@ }); $application->add(new Command('update-sink')) - ->setDefinition($inputDefinition) + ->setDefinition(clone $inputDefinition) ->setDescription('Updates a Logging sink') ->addOption( 'sink', @@ -161,14 +161,14 @@ }); $application->add(new Command('write')) - ->setDefinition($inputDefinition) + ->setDefinition(clone $inputDefinition) ->setDescription('Writes log entries to the given logger') - ->addArgument( - "message", - InputArgument::OPTIONAL, - "The log message to write", - "Hello" - ) + ->addArgument( + 'message', + InputArgument::OPTIONAL, + 'The log message to write', + 'Hello' + ) ->setCode(function ($input, $output) { $projectId = $input->getArgument('project'); $message = $input->getArgument('message'); @@ -176,6 +176,30 @@ write_log($projectId, $loggerName, $message); }); +$application->add(new Command('write-psr')) + ->setDefinition(clone $inputDefinition) + ->setDescription('Writes log entries using a PSR logger') + ->addArgument( + 'message', + InputArgument::OPTIONAL, + 'The log message to write', + 'Hello' + ) + ->addOption( + 'level', + null, + InputOption::VALUE_REQUIRED, + 'The log level for the PSR logger', + \Psr\Log\LogLevel::WARNING + ) + ->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $message = $input->getArgument('message'); + $loggerName = $input->getOption('logger'); + $level = $input->getOption('level'); + write_psr_log($projectId, $loggerName, $message, $level); + }); + // for testing if (getenv('PHPUNIT_TESTS') === '1') { return $application; diff --git a/logging/src/log_entry_functions.php b/logging/src/log_entry_functions.php index b516821e25..640ba5df33 100644 --- a/logging/src/log_entry_functions.php +++ b/logging/src/log_entry_functions.php @@ -77,7 +77,7 @@ function list_entries($projectId, $loggerName) $entryText = $entryInfo['textPayload']; } else { $entryPayload = []; - foreach ($jsonPayload as $key => $value) { + foreach ($entryInfo['jsonPayload'] as $key => $value) { $entryPayload[] = "$key=$value"; } $entryText = '{' . implode(', ', $entryPayload) . '}'; diff --git a/logging/src/psr_logger.php b/logging/src/psr_logger.php new file mode 100644 index 0000000000..79f6e3e2ed --- /dev/null +++ b/logging/src/psr_logger.php @@ -0,0 +1,37 @@ + $projectId]); + $logger = $logging->psrLogger($loggerName); + $logger->log($level, $message); + printf("Wrote to logger '%s' at level '%s'." . PHP_EOL, $loggerName, $level); +} +// [END write_psr_log] diff --git a/logging/test/loggingTest.php b/logging/test/loggingTest.php index 7dc399e3fd..d9587e9859 100644 --- a/logging/test/loggingTest.php +++ b/logging/test/loggingTest.php @@ -187,6 +187,20 @@ public function testDeleteLogger() ); } + public function testWritePsr() + { + $message = 'Test Message'; + $output = $this->runCommand('write-psr', [ + '--logger' => self::$loggerName, + '--level' => 'emergency', + 'message' => $message, + ]); + $this->assertEquals( + sprintf("Wrote to logger '%s' at level 'emergency'.\n", self::$loggerName), + $output + ); + } + public function runCommand($commandName, $additionalArgs = []) { $application = require __DIR__ . '/../logging.php'; From 3f1a524905bf0b6791f4a9672a9e9f7c5cd3fc4d Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 29 Sep 2017 11:14:34 -0700 Subject: [PATCH 4/7] adds monolog example --- logging/composer.json | 5 +- logging/composer.lock | 59 +++++++++++-------- logging/logging.php | 26 +++++++- logging/src/write_with_monolog_logger.php | 51 ++++++++++++++++ ...r_logger.php => write_with_psr_logger.php} | 8 +-- logging/test/loggingTest.php | 16 ++++- 6 files changed, 132 insertions(+), 33 deletions(-) create mode 100644 logging/src/write_with_monolog_logger.php rename logging/src/{psr_logger.php => write_with_psr_logger.php} (81%) diff --git a/logging/composer.json b/logging/composer.json index 6c9f8a0a22..d474c08704 100644 --- a/logging/composer.json +++ b/logging/composer.json @@ -1,6 +1,6 @@ { "require": { - "google/cloud-logging": "^1.0", + "google/cloud-logging": "dev-master as 1.0", "symfony/console": "^3.0", "monolog/monolog": "^1.23" }, @@ -11,7 +11,8 @@ "autoload": { "files": [ "src/log_entry_functions.php", - "src/psr_logger.php", + "src/write_with_psr_logger.php", + "src/write_with_monolog_logger.php", "src/sink_functions.php" ] } diff --git a/logging/composer.lock b/logging/composer.lock index a9e438caf7..e408643d66 100644 --- a/logging/composer.lock +++ b/logging/composer.lock @@ -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": "09c8128906b36c8561810b53d65f529a", + "content-hash": "a777f49dd5780c4a7c4bbadfbc32365b", "packages": [ { "name": "firebase/php-jwt", @@ -152,7 +152,7 @@ }, { "name": "google/cloud-logging", - "version": "v1.4.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-logging.git", @@ -989,32 +989,32 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1039,7 +1039,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "google/cloud-tools", @@ -1147,22 +1147,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.2.2", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^7.0", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.3.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -1188,20 +1188,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-08T06:39:58+00:00" + "time": "2017-08-30T18:51:59+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.3.0", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { @@ -1235,7 +1235,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-06-03T08:32:36+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", @@ -2316,9 +2316,18 @@ "time": "2016-11-23T20:04:58+00:00" } ], - "aliases": [], + "aliases": [ + { + "alias": "1.0", + "alias_normalized": "1.0.0.0", + "version": "9999999-dev", + "package": "google/cloud-logging" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "google/cloud-logging": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/logging/logging.php b/logging/logging.php index 892e3c1690..290dcfdeb2 100644 --- a/logging/logging.php +++ b/logging/logging.php @@ -197,7 +197,31 @@ $message = $input->getArgument('message'); $loggerName = $input->getOption('logger'); $level = $input->getOption('level'); - write_psr_log($projectId, $loggerName, $message, $level); + write_with_psr_logger($projectId, $loggerName, $message, $level); + }); + +$application->add(new Command('write-monolog')) + ->setDefinition(clone $inputDefinition) + ->setDescription('Writes log entries using a Monolog logger') + ->addArgument( + 'message', + InputArgument::OPTIONAL, + 'The log message to write', + 'Hello' + ) + ->addOption( + 'level', + null, + InputOption::VALUE_REQUIRED, + 'The log level for the PSR logger', + \Psr\Log\LogLevel::WARNING + ) + ->setCode(function ($input, $output) { + $projectId = $input->getArgument('project'); + $message = $input->getArgument('message'); + $loggerName = $input->getOption('logger'); + $level = $input->getOption('level'); + write_with_monolog_logger($projectId, $loggerName, $message, $level); }); // for testing diff --git a/logging/src/write_with_monolog_logger.php b/logging/src/write_with_monolog_logger.php new file mode 100644 index 0000000000..fe0c7afe2f --- /dev/null +++ b/logging/src/write_with_monolog_logger.php @@ -0,0 +1,51 @@ + $projectId + ]); + $logger = $logging->psrLogger($loggerName); + + // Create a Monolog logger + // NOTE: You can use an existing monolog client, i.e. when using Laravel or Symfony. + $monolog = new MonologLogger(); + + // Push the Psr logger onto the logger using a Monolog PsrHandler. + $handler = new PsrHandler($logger); + $monolog->pushHandler($handler); + + // Log the message + $monolog->log($level, $message); + printf("Wrote to monolog logger '%s' at level '%s'." . PHP_EOL, $loggerName, $level); +} +// [END write_with_monolog_logger] diff --git a/logging/src/psr_logger.php b/logging/src/write_with_psr_logger.php similarity index 81% rename from logging/src/psr_logger.php rename to logging/src/write_with_psr_logger.php index 79f6e3e2ed..8f5daf23ee 100644 --- a/logging/src/psr_logger.php +++ b/logging/src/write_with_psr_logger.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Samples\Logging; -// [START write_psr_log] +// [START write_with_psr_logger] use Google\Cloud\Logging\LoggingClient; use Psr\Log\LogLevel; @@ -27,11 +27,11 @@ * @param string $loggerName The name of the logger. * @param string $message The log message. */ -function write_psr_log($projectId, $loggerName, $message, $level = LogLevel::WARNING) +function write_with_psr_logger($projectId, $loggerName, $message, $level = LogLevel::WARNING) { $logging = new LoggingClient(['projectId' => $projectId]); $logger = $logging->psrLogger($loggerName); $logger->log($level, $message); - printf("Wrote to logger '%s' at level '%s'." . PHP_EOL, $loggerName, $level); + printf("Wrote to PSR logger '%s' at level '%s'." . PHP_EOL, $loggerName, $level); } -// [END write_psr_log] +// [END write_with_psr_logger] diff --git a/logging/test/loggingTest.php b/logging/test/loggingTest.php index d9587e9859..e93f3d1d17 100644 --- a/logging/test/loggingTest.php +++ b/logging/test/loggingTest.php @@ -196,7 +196,21 @@ public function testWritePsr() 'message' => $message, ]); $this->assertEquals( - sprintf("Wrote to logger '%s' at level 'emergency'.\n", self::$loggerName), + sprintf("Wrote to PSR logger '%s' at level 'emergency'.\n", self::$loggerName), + $output + ); + } + + public function testWriteMonolog() + { + $message = 'Test Message'; + $output = $this->runCommand('write-monolog', [ + '--logger' => self::$loggerName, + '--level' => 'emergency', + 'message' => $message, + ]); + $this->assertEquals( + sprintf("Wrote to Monolog logger '%s' at level 'emergency'.\n", self::$loggerName), $output ); } From b1d99f1aa7e3a8966f20c841b89000dd8928d509 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 29 Sep 2017 13:15:15 -0700 Subject: [PATCH 5/7] updates deps --- logging/composer.json | 2 +- logging/composer.lock | 59 ++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/logging/composer.json b/logging/composer.json index d474c08704..4db0773d28 100644 --- a/logging/composer.json +++ b/logging/composer.json @@ -1,6 +1,6 @@ { "require": { - "google/cloud-logging": "dev-master as 1.0", + "google/cloud-logging": "^1.0", "symfony/console": "^3.0", "monolog/monolog": "^1.23" }, diff --git a/logging/composer.lock b/logging/composer.lock index e408643d66..a9e438caf7 100644 --- a/logging/composer.lock +++ b/logging/composer.lock @@ -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": "a777f49dd5780c4a7c4bbadfbc32365b", + "content-hash": "09c8128906b36c8561810b53d65f529a", "packages": [ { "name": "firebase/php-jwt", @@ -152,7 +152,7 @@ }, { "name": "google/cloud-logging", - "version": "dev-master", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-logging.git", @@ -989,32 +989,32 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=5.3,<8.0-DEV" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -1039,7 +1039,7 @@ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "google/cloud-tools", @@ -1147,22 +1147,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=5.5", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.4.0", + "phpdocumentor/type-resolver": "^0.3.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -1188,20 +1188,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2017-08-08T06:39:58+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", "shasum": "" }, "require": { @@ -1235,7 +1235,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2017-06-03T08:32:36+00:00" }, { "name": "phpspec/prophecy", @@ -2316,18 +2316,9 @@ "time": "2016-11-23T20:04:58+00:00" } ], - "aliases": [ - { - "alias": "1.0", - "alias_normalized": "1.0.0.0", - "version": "9999999-dev", - "package": "google/cloud-logging" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "google/cloud-logging": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], From dcd5128023c3430c0aa98853e316ec3eb452e4dc Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 18 Oct 2017 11:04:44 -0700 Subject: [PATCH 6/7] updates logging to 1.5 --- logging/composer.json | 2 +- logging/composer.lock | 131 +++++++++++++++++++++--------------------- 2 files changed, 65 insertions(+), 68 deletions(-) diff --git a/logging/composer.json b/logging/composer.json index 4db0773d28..ad1ba387ae 100644 --- a/logging/composer.json +++ b/logging/composer.json @@ -1,6 +1,6 @@ { "require": { - "google/cloud-logging": "^1.0", + "google/cloud-logging": "^1.5", "symfony/console": "^3.0", "monolog/monolog": "^1.23" }, diff --git a/logging/composer.lock b/logging/composer.lock index a9e438caf7..bc7a81a956 100644 --- a/logging/composer.lock +++ b/logging/composer.lock @@ -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": "09c8128906b36c8561810b53d65f529a", + "content-hash": "3d0f0dd6780bdd2c65f07312037ed96f", "packages": [ { "name": "firebase/php-jwt", @@ -54,16 +54,16 @@ }, { "name": "google/auth", - "version": "v1.0.1", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/google/google-auth-library-php.git", - "reference": "db8e3022a308cb0e988026d38e67b91a42b41622" + "reference": "548d27d670f0236dc5258fa4cdde6e7b63464cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/db8e3022a308cb0e988026d38e67b91a42b41622", - "reference": "db8e3022a308cb0e988026d38e67b91a42b41622", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/548d27d670f0236dc5258fa4cdde6e7b63464cfd", + "reference": "548d27d670f0236dc5258fa4cdde6e7b63464cfd", "shasum": "" }, "require": { @@ -80,9 +80,6 @@ }, "type": "library", "autoload": { - "classmap": [ - "src/" - ], "psr-4": { "Google\\Auth\\": "src" } @@ -98,20 +95,20 @@ "google", "oauth2" ], - "time": "2017-07-31T16:34:40+00:00" + "time": "2017-10-10T17:01:45+00:00" }, { "name": "google/cloud-core", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-core.git", - "reference": "17d0a5150ebb21e8980adf1ea199d53f7a611d17" + "reference": "13cd745a71964f7c1e9190edeb14cdb994126d78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-core/zipball/17d0a5150ebb21e8980adf1ea199d53f7a611d17", - "reference": "17d0a5150ebb21e8980adf1ea199d53f7a611d17", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-core/zipball/13cd745a71964f7c1e9190edeb14cdb994126d78", + "reference": "13cd745a71964f7c1e9190edeb14cdb994126d78", "shasum": "" }, "require": { @@ -148,26 +145,26 @@ "Apache-2.0" ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", - "time": "2017-09-12T20:49:36+00:00" + "time": "2017-10-17T17:11:46+00:00" }, { "name": "google/cloud-logging", - "version": "v1.4.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/GoogleCloudPlatform/google-cloud-php-logging.git", - "reference": "0a06fcf1c0ead3e5491d3a68ffb0ef1d7b308f93" + "reference": "ef2c488c46eafaf6b8ea106e56ceb3e74add9693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-logging/zipball/0a06fcf1c0ead3e5491d3a68ffb0ef1d7b308f93", - "reference": "0a06fcf1c0ead3e5491d3a68ffb0ef1d7b308f93", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php-logging/zipball/ef2c488c46eafaf6b8ea106e56ceb3e74add9693", + "reference": "ef2c488c46eafaf6b8ea106e56ceb3e74add9693", "shasum": "" }, "require": { "google/cloud-core": "^1.0", - "google/gax": "^0.23", - "google/proto-client": "^0.23" + "google/gax": "^0.24", + "google/proto-client": "^0.24" }, "type": "library", "extra": { @@ -188,20 +185,20 @@ "Apache-2.0" ], "description": "Stackdriver Logging Client for PHP", - "time": "2017-09-12T20:49:36+00:00" + "time": "2017-10-17T17:11:46+00:00" }, { "name": "google/gax", - "version": "0.23.0", + "version": "0.24.0", "source": { "type": "git", "url": "https://github.com/googleapis/gax-php.git", - "reference": "e09f219ed50ea1f6162d1945156d2ea6af6cd1f9" + "reference": "94c4cf52f55115b7ee528474d72c7ed7829e1365" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/gax-php/zipball/e09f219ed50ea1f6162d1945156d2ea6af6cd1f9", - "reference": "e09f219ed50ea1f6162d1945156d2ea6af6cd1f9", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/94c4cf52f55115b7ee528474d72c7ed7829e1365", + "reference": "94c4cf52f55115b7ee528474d72c7ed7829e1365", "shasum": "" }, "require": { @@ -232,20 +229,20 @@ "keywords": [ "google" ], - "time": "2017-08-31T21:40:57+00:00" + "time": "2017-09-19T20:06:14+00:00" }, { "name": "google/proto-client", - "version": "0.23.0", + "version": "0.24.0", "source": { "type": "git", "url": "https://github.com/googleapis/proto-client-php.git", - "reference": "b159f408b6acdba55bf727c3639d03bb0117fc27" + "reference": "2f36eaa4a2fa1ee6f66525c8f40741acb27cec52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/proto-client-php/zipball/b159f408b6acdba55bf727c3639d03bb0117fc27", - "reference": "b159f408b6acdba55bf727c3639d03bb0117fc27", + "url": "https://api.github.com/repos/googleapis/proto-client-php/zipball/2f36eaa4a2fa1ee6f66525c8f40741acb27cec52", + "reference": "2f36eaa4a2fa1ee6f66525c8f40741acb27cec52", "shasum": "" }, "require": { @@ -272,7 +269,7 @@ "keywords": [ "google" ], - "time": "2017-09-01T22:33:04+00:00" + "time": "2017-09-18T19:35:44+00:00" }, { "name": "google/protobuf", @@ -804,16 +801,16 @@ }, { "name": "symfony/console", - "version": "v3.3.9", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf" + "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", - "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", + "url": "https://api.github.com/repos/symfony/console/zipball/116bc56e45a8e5572e51eb43ab58c769a352366c", + "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c", "shasum": "" }, "require": { @@ -868,20 +865,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-09-06T16:40:18+00:00" + "time": "2017-10-02T06:42:24+00:00" }, { "name": "symfony/debug", - "version": "v3.3.9", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "8beb24eec70b345c313640962df933499373a944" + "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944", - "reference": "8beb24eec70b345c313640962df933499373a944", + "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", + "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", "shasum": "" }, "require": { @@ -924,20 +921,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-09-01T13:23:39+00:00" + "time": "2017-10-02T06:42:24+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -949,7 +946,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -983,7 +980,7 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2017-10-11T12:05:26+00:00" } ], "packages-dev": [ @@ -2050,16 +2047,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.3.9", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "aee7120b058c268363e606ff5fe8271da849a1b5" + "reference": "317d5bdf0127f06db7ea294186132b4f5b036839" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/aee7120b058c268363e606ff5fe8271da849a1b5", - "reference": "aee7120b058c268363e606ff5fe8271da849a1b5", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/317d5bdf0127f06db7ea294186132b4f5b036839", + "reference": "317d5bdf0127f06db7ea294186132b4f5b036839", "shasum": "" }, "require": { @@ -2103,20 +2100,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-10-02T06:42:24+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.3.9", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "6b511d7329b203a620f09a2288818d27dcc915ae" + "reference": "40dafd42d5dad7fe5ad4e958413d92a207522ac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6b511d7329b203a620f09a2288818d27dcc915ae", - "reference": "6b511d7329b203a620f09a2288818d27dcc915ae", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/40dafd42d5dad7fe5ad4e958413d92a207522ac1", + "reference": "40dafd42d5dad7fe5ad4e958413d92a207522ac1", "shasum": "" }, "require": { @@ -2159,20 +2156,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-09-11T15:55:22+00:00" + "time": "2017-10-02T06:42:24+00:00" }, { "name": "symfony/process", - "version": "v3.3.9", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" + "reference": "fdf89e57a723a29baf536e288d6e232c059697b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "url": "https://api.github.com/repos/symfony/process/zipball/fdf89e57a723a29baf536e288d6e232c059697b1", + "reference": "fdf89e57a723a29baf536e288d6e232c059697b1", "shasum": "" }, "require": { @@ -2208,20 +2205,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-10-02T06:42:24+00:00" }, { "name": "symfony/yaml", - "version": "v3.3.9", + "version": "v3.3.10", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0" + "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1d8c2a99c80862bdc3af94c1781bf70f86bccac0", - "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "url": "https://api.github.com/repos/symfony/yaml/zipball/8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", + "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", "shasum": "" }, "require": { @@ -2263,7 +2260,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-10-05T14:43:42+00:00" }, { "name": "webmozart/assert", From 74e3d9c4def63c033b415ea028a831b1c585d41e Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Oct 2017 14:36:38 -0700 Subject: [PATCH 7/7] test fixes --- logging/src/write_with_monolog_logger.php | 4 ++-- logging/test/loggingTest.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/logging/src/write_with_monolog_logger.php b/logging/src/write_with_monolog_logger.php index fe0c7afe2f..4554e4943d 100644 --- a/logging/src/write_with_monolog_logger.php +++ b/logging/src/write_with_monolog_logger.php @@ -20,7 +20,7 @@ // [START write_with_monolog_logger] use Google\Cloud\Logging\LoggingClient; use Monolog\Handler\PsrHandler; -use Monolog\Logger; +use Monolog\Logger as MonologLogger; use Psr\Log\LogLevel; /** Write a log message via the Stackdriver Logging API. @@ -38,7 +38,7 @@ function write_with_monolog_logger($projectId, $loggerName, $message, $level = L // Create a Monolog logger // NOTE: You can use an existing monolog client, i.e. when using Laravel or Symfony. - $monolog = new MonologLogger(); + $monolog = new MonologLogger($loggerName); // Push the Psr logger onto the logger using a Monolog PsrHandler. $handler = new PsrHandler($logger); diff --git a/logging/test/loggingTest.php b/logging/test/loggingTest.php index e93f3d1d17..0d28e82e83 100644 --- a/logging/test/loggingTest.php +++ b/logging/test/loggingTest.php @@ -136,7 +136,6 @@ public function testUpdateSinkWithFilter() public function testDeleteSink() { $output = $this->runCommand('delete-sink', [ - // '--logger' => self::$loggerName, '--sink' => self::$sinkName, ]); $this->assertEquals( @@ -210,7 +209,7 @@ public function testWriteMonolog() 'message' => $message, ]); $this->assertEquals( - sprintf("Wrote to Monolog logger '%s' at level 'emergency'.\n", self::$loggerName), + sprintf("Wrote to monolog logger '%s' at level 'emergency'.\n", self::$loggerName), $output ); }