Logging for RedwoodJS

Hello folks,

I’ve been thinking about how to integrate logging tools, logre.io specifically, for RedwoodJS and, initially, I thought of a plugin/integration system, however, RedwoodJS exposes a configuration of options in createGraphQLHandler in graphql.js, so that developers could pass an array of plugins to ApolloServer (https://www.apollographql.com/docs/apollo-server/integrations/plugins/#installing-a-plugin) and have the log working with some minor changes.

import LogreIOPlugin from 'logreio-apollo-server'

export const handler = createGraphQLHandler({
  getCurrentUser,
  plugins: [
    LogreIOPlugin({
      id: "266715545538134546",
      key: "****"
    })
  ],
  schema: makeMergedSchema({
    schemas,
    services: makeServices({ services }),
  }),
  db,
})

Although, I think that would be nice to have logging for more app pieces. I would love to hear which pieces do you think logging is important. Have more samples could help us(community) to define a good plugin/integration system, if it worths.

Thank you!

1 Like

Hi @BrunoQuaresma! Apologies for the slow reply here. Personally I’m a huge proponent of logging and I know this will eventually become a critical feature for Redwood to integrate. I just don’t think many people are far enough along yet to be thinking about it.

My last project used Docker/Kubernetes, and I set up Papertrail via Fluentd. Unfortunately, that doesn’t give me much insight into how this needs to work in the world of Lambdas and Browsers.

As far as “more app pieces”, if you’re logging each individual lambda function (so each file in api/src/functions), that seems like a majority of the coverage you’d need. Personally I’d :heart:to get browser console logs, but I have no idea of examples of this outside using Fullstory session tracking including console errors.

Lastly, I wonder if there’s a way to tap into the logs Netlify is already keeping (but not for longer than one hour)?

Have you taken any further steps since writing this?

This might be of interest on the DB side of things-- as of Prisma beta.9 there’s an exposed logger interface: