Merge pull request #1769 from automatisch/rest-logger

refactor: Use additional logger line only for graphQL
This commit is contained in:
Ömer Faruk Aydın
2024-03-26 16:25:12 +01:00
committed by GitHub

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 }
); );