Skip to content

Commit adc8472

Browse files
authored
chore!: Promote Logging to V2 (#9007)
1 parent 151bc8d commit adc8472

134 files changed

Lines changed: 1738 additions & 13149 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Core/tests/Unit/ServiceBuilderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ public function serviceProvider()
142142
[
143143
'bigQuery',
144144
BigQueryClient::class
145-
], [
146-
'logging',
147-
LoggingClient::class
148145
], [
149146
'language',
150147
LanguageClient::class

Logging/MIGRATING.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Migrating Google Cloud Logging from V1 to V2
2+
3+
## How to upgrade
4+
5+
Update your `google/cloud-logging` dependency to `^2.0`:
6+
7+
```
8+
{
9+
"require": {
10+
"google/cloud-logging": "^2.0"
11+
}
12+
}
13+
```
14+
15+
## Changes
16+
17+
### Client Options changes
18+
19+
The following client options are removed/replaced with other options present in
20+
[`ClientOptions`][ClientOptions]. This was done to ensure client options are consistent across all
21+
Google Cloud clients.
22+
23+
- `authCache` -> Moved to `credentialsConfig.authCache`
24+
- `authCacheOptions` -> Moved to `credentialsConfig.authCacheOptions`
25+
- `credentialsFetcher` -> Moved to `credentials`
26+
- `keyFile` -> Moved to `credentials`
27+
- `keyFilePath` -> Moved to `credentials`
28+
- `requestTimeout` -> Removed from client options and moved to a call option `timeoutMillis`
29+
- `scopes` -> Moved to `credentialsConfig.scopes`
30+
- `quotaProject` -> Moved to `credentialsConfig.quotaProject`
31+
- `httpHandler` -> Moved to `transportConfig.rest.httpHandler`
32+
- `authHttpHandler` -> Moved to `credentialsConfig.authHttpHandler`
33+
- `retries` -> Removed from client options and moved to call options `retrySettings.maxRetries`
34+
35+
### Retry Options changes
36+
37+
The retry options have been moved to use [`RetrySettings`][RetrySettings] in call options
38+
and function parameters.
39+
40+
- `retries` -> Renamed to `retrySettings.maxRetries`
41+
- `maxRetries` -> Renamed to `retrySettings.maxRetries`
42+
43+
[RetrySettings]: https://googleapis.github.io/gax-php/v1.26.1/Google/ApiCore/RetrySettings.html
44+
45+
[ClientOptions]: https://googleapis.github.io/gax-php/v1.26.1/Google/ApiCore/Options/ClientOptions.html
46+
47+
### `ConnectionInterface`, `Connection\Grpc`, and `Connection\Rest` are not used anymore.
48+
49+
This is a major change, but one that we hope won't break any users. When the
50+
`LoggingClient` was created, behind the scenes a connection adapter was initialized.
51+
52+
The Rest and Grpc connection classes (along with the `ConnectionInterface`) have been
53+
removed in favor of using the GAPIC generated clients directly. See `src/Connection/Gapic.php`
54+
for an example.
55+
56+

Logging/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"minimum-stability": "stable",
66
"require": {
77
"php": "^8.1",
8-
"google/cloud-core": "^1.61",
8+
"google/cloud-core": "^1.66",
99
"google/gax": "^1.38.0"
1010
},
1111
"require-dev": {
@@ -20,7 +20,8 @@
2020
"google/cloud-bigquery": "^1.0",
2121
"google/cloud-pubsub": "^2.0",
2222
"opis/closure": "^3",
23-
"monolog/monolog": "^3.8"
23+
"monolog/monolog": "^3.8",
24+
"dg/bypass-finals": "^1.9"
2425
},
2526
"provide": {
2627
"psr/log-implementation": "2.0||3.0"

Logging/owlbot.py

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Google LLC
1+
# Copyright 2024 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -32,29 +32,16 @@
3232

3333
php.owlbot_main(src=src, dest=dest)
3434

35-
36-
### [START] protoc backwards compatibility fixes
37-
38-
# roll back to private properties.
39-
s.replace(
40-
"src/**/V*/**/*.php",
41-
r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$",
42-
r"""Generated from protobuf field \1
43-
*/
44-
private $""")
45-
46-
# Replace "Unwrapped" with "Value" for method names.
47-
s.replace(
48-
"src/**/V*/**/*.php",
49-
r"public function ([s|g]\w{3,})Unwrapped",
50-
r"public function \1Value"
51-
)
52-
53-
### [END] protoc backwards compatibility fixes
54-
55-
# fix relative cloud.google.com links
56-
s.replace(
57-
"src/**/V*/**/*.php",
58-
r"(.{0,})\]\((/.{0,})\)",
59-
r"\1](https://cloud.google.com\2)"
60-
)
35+
# format generated clients
36+
subprocess.run([
37+
'npm',
38+
'exec',
39+
'--yes',
40+
'--package=@prettier/plugin-php@^0.19',
41+
'--',
42+
'prettier',
43+
'**/Client/*',
44+
'--write',
45+
'--parser=php',
46+
'--single-quote',
47+
'--print-width=120'])

Logging/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/Unit/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
33
<coverage>
44
<include>
55
<directory suffix=".php">src</directory>

Logging/src/Connection/ConnectionInterface.php

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)