PluginProbe
Gmail SMTP / trunk
Gmail SMTP vtrunk
1.2.3.21 1.2.3.20 trunk 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.9 1.2.0 1.2.3.14 1.2.3.15 1.2.3.16 1.2.3.18 1.2.3.5
gmail-smtp / google-api-php-client / vendor / google / auth / src / Logging / RpcLogEvent.php

RpcLogEvent.php in Gmail SMTP trunk, at google-api-php-client/vendor/google/auth/src/Logging/RpcLogEvent.php

137 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Copyright 2024 Google Inc. All Rights Reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 namespace Google\Auth\Logging;
19
20 /**
21 * A class that contains all the required information for logging.
22 *
23 * @internal
24 */
25 class RpcLogEvent
26 {
27 /**
28 * Timestamp in format RFC3339 representing when this event ocurred
29 *
30 * @var string
31 */
32 public string $timestamp;
33
34 /**
35 * The time in milliseconds at time on creation for calculating latency
36 *
37 * @var float
38 */
39 public float $milliseconds;
40
41 /**
42 * Rest method type
43 *
44 * @var null|string
45 */
46 public null|string $method = null;
47
48 /**
49 * URL representing the rest URL endpoint
50 *
51 * @var null|string
52 */
53 public null|string $url = null;
54
55 /**
56 * An array that contains the headers for the response or request
57 *
58 * @var null|array<mixed>
59 */
60 public null|array $headers = null;
61
62 /**
63 * An array representation of JSON for the response or request
64 *
65 * @var null|string
66 */
67 public null|string $payload = null;
68
69 /**
70 * Status code for REST or gRPC methods
71 *
72 * @var null|int|string
73 */
74 public null|int|string $status = null;
75
76 /**
77 * The latency in milliseconds
78 *
79 * @var null|int
80 */
81 public null|int $latency = null;
82
83 /**
84 * The retry attempt number
85 *
86 * @var null|int
87 */
88 public null|int $retryAttempt = null;
89
90 /**
91 * The name of the gRPC method being called
92 *
93 * @var null|string
94 */
95 public null|string $rpcName = null;
96
97 /**
98 * The Service Name of the gRPC
99 *
100 * @var null|string $serviceName
101 */
102 public null|string $serviceName = null;
103
104 /**
105 * The Process ID for tracing logs
106 *
107 * @var null|int $processId
108 */
109 public null|int $processId = null;
110
111 /**
112 * The Request id for tracing logs
113 *
114 * @var null|int $requestId;
115 */
116 public null|int $requestId = null;
117
118 /**
119 * Creates an object with all the fields required for logging
120 * Passing a string representation of a timestamp calculates the difference between
121 * these two times and sets the latency field with the result.
122 *
123 * @param null|float $startTime (Optional) Parameter to calculate the latency
124 */
125 public function __construct(null|float $startTime = null)
126 {
127 $this->timestamp = date(DATE_RFC3339);
128
129 // Takes the micro time and convets it to millis
130 $this->milliseconds = round(microtime(true) * 1000);
131
132 if ($startTime) {
133 $this->latency = (int) round($this->milliseconds - $startTime);
134 }
135 }
136 }
137