Skip to content

debug

hooks
Source Code | Documentation

Logs the current hook context to the console for debugging purposes. Displays timestamp, service path, method, type, id, data, query, result, and any additional param fields you specify.

ts
  import { 
debug
} from 'feathers-utils/hooks';

Example

ts
import { debug } from 'feathers-utils/hooks'

app.service('users').hooks({
  before: { find: [debug('before find', 'user')] }
})

Type declaration

Show Type Declarations
ts
/**
 * Logs the current hook context to the console for debugging purposes.
 * Displays timestamp, service path, method, type, id, data, query, result, and
 * any additional param fields you specify.
 *
 * @example
 * ```ts
 *
 *
 * app.service('users').hooks({
 *   before: { find: [debug('before find', 'user')] }
 * })
 * ```
 *
 * @see https://utils.feathersjs.com/hooks/debug.html
 */
export declare const debug: <H extends HookContext = HookContext>(
  msg: string,
  ...fieldNames: string[]
) => (context: H, next?: NextFunction) => Promise<void>
ArgumentTypeDescription
msgstring
fieldNamesstring[]
typemethodsmulti
before, afterallyes

Released under the MIT License.