Last active
October 2, 2022 14:50
-
-
Save philsch/2310dda87bba86ae59e0cbad04de97da to your computer and use it in GitHub Desktop.
gcloud log example three
This file contains hidden or 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
const functions = require('@google-cloud/functions-framework'); | |
functions.http('test_three', async (req, res) => { | |
// Writes some log entries | |
console.log(JSON.stringify({severity: 'INFO', message: 'info log'})); | |
console.log(JSON.stringify({severity: 'WARNING', message: 'warn log'})); | |
console.log(JSON.stringify({severity: 'ERROR', message: 'error log'})); | |
console.log(JSON.stringify({ | |
severity: 'ERROR', | |
message: new Error('js error').stack | |
})); | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('hello world'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment