Hi Adam,
thank you for your answer.
I am probably just dumb, but I can't make the Cloud Logging APIs work.
I have installed @google-cloud/logging through
npm install --save @google-cloud/logging
as pointed out in the documentation, put a random
logging.log('this is a log')
in the / root handler, before sending back a response to the client, and still, when I access the page,
I only get an internal server error. The corresponding log in Stackdriver is simply: "TypeError: logging.log is not a function at app.get"
My code currently looks as simple as this:
const express = require('express');
var logging = require('@google-cloud/logging');
const app = express();
app.get('/', (req, res) => {
logging.log('this is a super cool log'); // Shouldn't this log?
res.status(200).send('Hello, world!');
});
if (module === require.main) {
const server = app.listen(process.env.PORT || 8080, () => {
const port = server.address().port;
console.log(`App listening on port ${port}`);
})
}
module.exports = app;
I can't understand very well how to use it nor I can find a complete example.
Any help would be really appreciated.