Closed koistya closed 2 years ago
logging
stdin
stdout
ctx.log(...)
Context
ctx.params
From within the GraphQL type resolvers:
{ type: UserType, resolve(self, args, ctx) { ctx.log("INFO", "Fetching user account."); try { /* .... */ } catch (err) { ctx.log("ERROR", err); } } }
Or, from anywhere within the Node.js/Express app:
import { log } from "./core"; app.get("/example", (req, res) => { log(req, res, "INFO", "Hello from Express app."); ... });
Reference https://cloud.google.com/functions/docs/monitoring/logging
logging
compatibility with Google Cloud Functions (2nd gen)stdin
/stdout
as a simple solutionctx.log(...)
helper function toContext
available from GraphQL resolver functionsContext
(ctx.params
)Usage Example
From within the GraphQL type resolvers:
Or, from anywhere within the Node.js/Express app:
Reference https://cloud.google.com/functions/docs/monitoring/logging