Skip to content

Make logs (errors, warnings) useful #1656

@dalisoft

Description

@dalisoft

Before you submit an issue we recommend you drop into the Gitter community or Fastify Help and ask any questions you have or mention any problems you've had getting started with Fastify.

Please read this entire template before posting any issue. If you ignore these instructions
and post an issue here that does not follow the instructions, your issue might be closed,
locked, and assigned the missing discussion label.

🐛 Bug Report

A clear and concise description of what the bug is.

Logs aren't useful, especially for beginners.

To Reproduce

Steps to reproduce the behavior:

Use fastify as backend with some plugins.

My log:

[Server]: Warning: The route option `beforeHandler` has been deprecated, use `preHandler` instead
    at beforeHandlerWarning (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/fastify/lib/warnings.js611)
    at Object.afterRouteAdded (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/fastify/fastify.js4909)
    at /Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/fastify/fastify.js42729
    at Object.encapsulateThreeParam (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/nodemodules/avvio/boot.js4197)
    at Boot.callWithCbOrNextTick (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/avvio/boot.js3415)
    at Boot.after (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/nodemodules/avvio/boot.js23226)
    at Plugin.exec (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/avvio/plugin.js8917)
    at Boot.loadPlugin (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/avvio/plugin.js17510)
    at Task.release (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/fastq/queue.js12716)
    at worked (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/fastq/queue.js16910)
    at /Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/avvio/plugin.js1787
    at done (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/avvio/plugin.js1365)
    at check (/Users/dalisoft/Desktop/Dev Env from null/fastifydevenv/node_modules/avvio/plugin.js1477)
    at processTicksAndRejections (internal/process/task_queues.js829)

Expected behavior

A clear and concise description of what you expected to happen.

Logs should show which plugin or where warning/error happened.

Your Environment

  • node version: 12
  • fastify version: >=2.0.0
  • os: Mac
  • repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions