We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ffb4897 commit 81cc005Copy full SHA for 81cc005
src/utils/logger.ts
@@ -13,9 +13,13 @@ morgan.token('graphql-operation', (req: express.Request) => {
13
if (req.body && req.body.query) {
14
/* Try to extract operation name from query string if operationName is not provided */
15
const match = req.body.query.match(/(?:query|mutation)\s+(\w+)/);
16
+ const isMutation = req.body.query.includes('mutation');
17
+
18
+ const effect = isMutation ? Effect.ForegroundRed : Effect.ForegroundMagenta;
19
+ const prefix = sgr(isMutation ? 'Mutation' : 'Query', effect);
20
21
if (match && match[1]) {
- return sgr(sgr(match[1], Effect.ForegroundMagenta), Effect.Bold);
22
+ return prefix + ' ' + sgr(sgr(match[1], effect), Effect.Bold);
23
}
24
25
0 commit comments