Expose GraphQL operation in logs with Absinthe
We always use named operations in our GraphQL requests, so we thought it would be a good idea to include the operation name in logs so instead of:
20:33:56.107 request_id=… [info] POST /graphql
20:33:56.239 request_id=… [info] Sent 200 in 84ms
We have
20:33:56.107 request_id=… [info] POST /graphql
20:33:56.239 request_id=… graphql_operation_name=UserProfile [info] Sent 200 in 84ms
We used Absinthe’s powerful middleware feature to achieve this: https://craft.mirego.com/2022-10-06-expose-graphql-operation-in-logs-with-absinthe
Read next Elixir vs Cybersecurity - is Elixir Language a Safe Technology?