Skip to content

Commit

Permalink
Add the internal tag to internal classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed Dec 3, 2024
1 parent db765ec commit f35e295
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/Logging/LoggingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

use Psr\Log\LogLevel;

/**
* A trait used to call a PSR-3 logging interface.
*
* @internal
*/
trait LoggingTrait
{
/**
Expand Down Expand Up @@ -47,7 +52,7 @@ private function logRequest(RpcLogEvent $event): void
// Remove null values
$debugEvent['jsonPayload'] = array_filter($jsonPayload, fn ($value) => !is_null($value));

$stringifiedEvent = json_encode($debugEvent);
$stringifiedEvent = json_encode($debugEvent, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

// There was an error stringifying the event, return to not break execution
if ($stringifiedEvent === false) {
Expand All @@ -70,7 +75,7 @@ private function logResponse(RpcLogEvent $event): void
'jsonPayload' => [
'response.headers' => $event->headers,
'response.payload' => $this->truncatePayload($event->payload),
'latency' => $event->latency,
'latencyMillis' => $event->latency,
]
];

Expand All @@ -81,7 +86,7 @@ private function logResponse(RpcLogEvent $event): void
fn ($value) => !is_null($value)
);

$stringifiedEvent = json_encode($debugEvent);
$stringifiedEvent = json_encode($debugEvent, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

// There was an error stringifying the event, return to not break execution
if ($stringifiedEvent !== false) {
Expand Down Expand Up @@ -114,7 +119,7 @@ private function logStatus(RpcLogEvent $event): void
fn ($value) => !is_null($value)
);

$stringifiedEvent = json_encode($infoEvent);
$stringifiedEvent = json_encode($infoEvent, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

// There was an error stringifying the event, return to not break execution
if ($stringifiedEvent === false) {
Expand Down
5 changes: 5 additions & 0 deletions src/Logging/RpcLogEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

namespace Google\Auth\Logging;

/**
* A class that contains all the required information for logging.
*
* @internal
*/
class RpcLogEvent
{
/**
Expand Down
4 changes: 3 additions & 1 deletion src/Logging/StdOutLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
use Stringable;

/**
* A basic logger class to log into stdOut for GCP logging
* A basic logger class to log into stdOut for GCP logging.
*
* @internal
*/
class StdOutLogger implements LoggerInterface
{
Expand Down

0 comments on commit f35e295

Please sign in to comment.