File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 11<?php
2+
23/**
34 * Copyright 2018 Google Inc.
45 *
2627$ logger ->warning ('This will show up as log level WARNING ' );
2728$ logger ->error ('This will show up as log level ERROR ' );
2829
30+ // Create the proper filter to view the logs in Stackdriver
31+ $ projectId = getenv ('GOOGLE_CLOUD_PROJECT ' );
32+ $ moduleId = getenv ('GAE_SERVICE ' );
33+ $ versionId = getenv ('GAE_VERSION ' );
34+
35+ $ resource = sprintf (
36+ 'gae_app/module_id/%s/version_id/%s ' ,
37+ $ moduleId ,
38+ $ versionId
39+ );
40+ $ logName = sprintf ('projects/%s/logs/app ' , $ projectId );
41+
42+ $ url = sprintf (
43+ 'https://console.cloud.google.com/logs/viewer?resource=%s&logName=%s ' ,
44+ urlencode ($ resource ),
45+ urlencode ($ logName )
46+ );
47+
2948?>
3049
31- Logged INFO, WARNING, and ERROR log levels. Visit console.cloud.google.com/logs to see them
50+ <p>Logged INFO, WARNING, and ERROR log levels. Visit the URL below to see them:</p>
51+
52+ <p><a href="<?= $ url ?> "><?= $ url ?> </a></p>
53+
54+ <?php phpinfo () ?>
You can’t perform that action at this time.
0 commit comments