useLogger

Logs parameters and information about the execution phases. You can easily plug your custom logger.

Weekly downloads
4.3M
Version
6.0.0
License
MIT
Updated
Oct 22, 2026

coreutilities

useLogger

Logs parameters and information about the execution phases. You can easily plug your custom logger.

import { execute, parse, subscribe, validate } from 'graphql'
import { envelop, specifiedRules, useEngine, useLogger } from '@envelop/core'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    useLogger({
      logFn: (eventName, args) => {
        // Event could be `execute-start` / `execute-end` / `subscribe-start` / `subscribe-end`
        // `args` will include the arguments passed to execute/subscribe (in case of "start" event) and additional result in case of "end" event.
      }
    })
    // ... other plugins ...
  ]
})