npm blitz 2.0.0-beta.30
v2.0.0-beta.30

latest releases: 2.1.0, 2.1.1, 2.1.0-canary-4...
14 months ago

🐞 Patches

  • c5572be: blitz-auth: Fix webpack from following next-auth

🚀 New Features

  • 7277349: ### Now we can configure Blitz RPC in the following way,

    In your [[...blitz]].ts api file you can see the following settings

    logging?: {
      /**
       * allowList Represents the list of routes for which logging should be enabled
       * If whiteList is defined then only those routes will be logged
       */
      allowList?: string[]
      /**
       * blockList Represents the list of routes for which logging should be disabled
       * If blockList is defined then all routes except those will be logged
       */
      blockList?: string[]
      /**
       * verbose Represents the flag to enable/disable logging
       * If verbose is true then Blitz RPC will log the input and output of each resolver
       */
      verbose?: boolean
      /**
       * disablelevel Represents the flag to enable/disable logging for a particular level
       */
      disablelevel?: "debug" | "info"
    }
    import { rpcHandler } from "@blitzjs/rpc"
    import { api } from "src/blitz-server"
    
    export default api(
      rpcHandler({
        onError: console.log,
        formatError: (error) => {
          error.message = `FormatError handler: ${error.message}`
          return error
        },
       logging: {
    ...
    }
      })
    )

    Example:

    export default api(
      rpcHandler({
        onError: console.log,
        formatError: (error) => {
          error.message = `FormatError handler: ${error.message}`
          return error
        },
        logging: {
          verbose: true,
          blockList: ["getCurrentUser", ...], //just write the resolver name [which is the resolver file name]
        },
      })
    )

    This is enable verbose blitz rpc logging for all resolvers except the resolvers getCurrentUser and others mentioned in the blockList

Don't miss a new blitz release

NewReleases is sending notifications on new releases.