import pino from 'pino'
import pinoExpress from 'express-pino-logger'
import logger from 'feathers-logger'

export default app => {
  const pinoLogger = pino()
  pinoLogger.level = process.env.NODE_ENV !== 'PRODUCTION' ? 'debug' : 'warn'
  app.configure(logger(pinoLogger))
  app.use(pinoExpress())
  app.info(process.env.NODE_ENV)
}

export const loggerHook = context => {
  const { app } = context

  app.info(`${context.type} app.service('${context.path}').${context.method}()`)

  if (typeof context.toJSON === 'function') {
    app.debug('Hook Context', context)
  }

  if (context.error) {
    app.error('error', context.error)
  }
}

@@ -597,40 +597,334 @@
     
-app.error('error', context.error
+const %7B%0A      error: %7B name, message, data: errorData %7D,%0A      data,%0A      result,%0A      params,%0A      dispatch%0A    %7D = context%0A    app.error(name, message, errorData)%0A    app.debug('context.params', params)%0A    app.debug('context.data', data)%0A    app.debug('context.result', result)%0A    app.debug('context.dispatch', dispatch
 )%0A  

Improve error logging.