refactor: Use additional logger line only for graphQL

This commit is contained in:
Faruk AYDIN
2024-03-26 15:38:55 +01:00
parent 8ab6f0c3fe
commit 190f1a205f

View File

@@ -9,7 +9,7 @@ const stream = {
const registerGraphQLToken = () => { const registerGraphQLToken = () => {
morgan.token('graphql-query', (req) => { morgan.token('graphql-query', (req) => {
if (req.body.query) { if (req.body.query) {
return `GraphQL ${req.body.query}`; return `\n GraphQL ${req.body.query}`;
} }
}); });
}; };
@@ -17,7 +17,7 @@ const registerGraphQLToken = () => {
registerGraphQLToken(); registerGraphQLToken();
const morganMiddleware = morgan( const morganMiddleware = morgan(
':method :url :status :res[content-length] - :response-time ms\n:graphql-query', ':method :url :status :res[content-length] - :response-time ms :graphql-query',
{ stream } { stream }
); );