Skip to content

Instantly share code, notes, and snippets.

@philsch
Last active October 2, 2022 14:50
Show Gist options
  • Save philsch/2310dda87bba86ae59e0cbad04de97da to your computer and use it in GitHub Desktop.
Save philsch/2310dda87bba86ae59e0cbad04de97da to your computer and use it in GitHub Desktop.
gcloud log example three
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