Add GraphQL operation name, user ID and actor name in logs

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-11-06 11:57:53 +01:00
parent de8433cdbb
commit 30b0d3ca08
5 changed files with 38 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ defmodule Mobilizon.GraphQL.Schema do
alias Mobilizon.Actors.{Actor, Follower, Member}
alias Mobilizon.Discussions.Comment
alias Mobilizon.Events.{Event, Participant}
alias Mobilizon.GraphQL.Middleware.{CurrentActorProvider, ErrorHandler}
alias Mobilizon.GraphQL.Middleware.{CurrentActorProvider, ErrorHandler, OperationNameLogger}
alias Mobilizon.GraphQL.Schema
alias Mobilizon.GraphQL.Schema.Custom
alias Mobilizon.Storage.Repo
@@ -199,7 +199,7 @@ defmodule Mobilizon.GraphQL.Schema do
@spec middleware(list(module()), any(), map()) :: list(module())
def middleware(middleware, _field, %{identifier: type}) when type in [:query, :mutation] do
[CurrentActorProvider] ++ middleware ++ [ErrorHandler]
[CurrentActorProvider] ++ middleware ++ [ErrorHandler, OperationNameLogger]
end
def middleware(middleware, _field, _object) do