{"repo":"Eomm/mercurius-logging","free":true,"listed":false,"github":"https://github.com/Eomm/mercurius-logging","clone":"git clone https://github.com/Eomm/mercurius-logging.git","description":"Log the GraphQL details","language":"JavaScript","stars":18,"topics":["fastify","graphql","logging","mercurius","plugin","fastify-plugin","hacktoberfest"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"mercurius-logging This plugin add a Log with all the GraphQL details you need. The issue By default, Fastify logs a simple request that shows always the same url : This output does not let you know which queries or mutations are being executed, unless you print or inspect the GQL payload. This plugin adds this log output to your application: When the request contains some mutations: Here a complete example when you turn on all the log options: If the mercurius graphql decorator is used, it is necessary to provide a context object: app.graphql(query, { reply }) . Otherwise, this plugin will ignore the request. Install Compatibility Plugin version Fastify version ------------- :---------------: ^2.0.0 ^5.0.0 ^1.0.0 ^4.0.0 Usage Options You can customize the output of the plugin by passing an options object: logLevel The log level of the plugin. Note that the request logger is used, so you will get the additional request data such as the reqId . logRequest Add to the log line the req: request object. This is useful if you want to log the request's headers or other. You can customize what to log by using the logSerializers option of Fastify. prependAlias Queries and mutations may have an alias. If you want to append the alias to the log, set this option to true . You will get the following output: logBody If you want to include the body of the request in the log output, set this option to true . You can provide a syncronous function to choose to log the body or not. The function ","default_branch":null,"files":null,"tree":[],"storefront":"/r/Eomm","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Eomm/mercurius-logging/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}