kriasoft / graphql-starter-kit

💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, and Joy UI.
https://graphqlstart.com
MIT License
3.88k stars 553 forks source link

chore(api): Improve logging and error status code #328

Closed koistya closed 2 years ago

koistya commented 2 years ago

If you're using import { log } from "./core" directly (as opposed ctx.log(...)), the res argument is now ommited:

import { log } from "../core";

// BEFORE
log(req, res, "WARNING", "Some text or object");

// AFTER
log(req, "WARNING", "Some text or object")

When used inside GraphQL type resolvers, nothing has changed:

async resolve(self, args, ctx) {
  ctx.log("ERROR", new Error(...));
}