Last active
January 27, 2022 13:06
-
-
Save enumag/ac4e2d697ce287ad7646ee0eb367404c to your computer and use it in GitHub Desktop.
[Medium] Logging in Cloud Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types = 1); | |
use Google\Cloud\Logging\LoggingClient; | |
$client = new LoggingClient(['projectId' => $projectId]); | |
$logger = $client->psrLogger( | |
'app', | |
[ | |
'resource' => [ | |
'type' => 'cloud_function', | |
'labels' => [ | |
'function_name' => $functionName, | |
'region' => $region, | |
], | |
], | |
] | |
); | |
$logger->log($severity, $message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment