Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
// A hook that logs service method before, after and error // See https://github.com/winstonjs/winston for documentation // about the logger. import logger from '../logger'; import util from 'util'; import { HookContext, Hook } from '@feathersjs/feathers'; // To see more detailed messages, uncomment the following line: logger.level = 'debug'; export default function (): Hook { return (context: HookContext) => { const { params } = context; const requestId = params.requestId; logger.debug(`Request Id: ${requestId}`); // This debugs the service call and a stringified version of the hook context // You can customize the message (and logger) to your needs logger.debug( `${context.type} app.service('${context.path}').${context.method}()`, ); if ( // eslint-disable-next-line @typescript-eslint/no-explicit-any typeof (context as any).toJSON === 'function' && logger.level === 'debug' ) { logger.debug('Hook Context', util.inspect(context, { colors: false })); } if (context.error && !context.result) { logger.error(context.error.stack); } }; }