generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: improved query logging #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hm23
requested changes
Jul 3, 2023
schwma
commented
Jul 3, 2023
| let _log | ||
|
|
||
| beforeAll(async () => { | ||
| await cds.deploy(path.join(PROJECT_PATH, 'srv')) |
Member
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hm23 btw, since we were talking about this: This is a way to deploy to SQLite in-memory with cds.test, even if NODE_ENV=production is set.
hm23
approved these changes
Jul 3, 2023
johannes-vogel
added a commit
that referenced
this pull request
Jul 5, 2023
* refactor: move graphiql GET route registration into `graphiql.js` (#98) * Move graphiql GET route registration into graphiql.js * Remove underscore prefix since function isn't private * chore: prepare next release (#99) * adapt urls and references to repo name (#100) * feat: improved query logging (#85) * Don't log 'GET undefined' when missing query * WIP improved request logger * Add operationName and variables to object * Extract request logger to own module * Add changelog entry * Reformat changelog entry * Remove outdated changelog entry * Remove padding after query * Prettier format * Log `operationName` and `variables` from URL query parameter * Parse variables JSON string if taken from `req.query` * Add typeof object short-circuiting before Object.keys * Sanitize arguments and their values in production * Reorder changelog entries * Rename requestLogger to queryLogger * Add query logging tests * Rename `logger.test.js` to `logger-dev.test.js` * Add test for log sanetization in production * Prettier format * Fix logger module path * Fix truncation of nested variables * Fix typo * Move object formatting to only affect query info object * Add and improve comments * Log variables object as '***' in production * Fix typo * Use mocked instead of dummy auth * Add dev logging tests to prod to ensure no unwanted values are sanitized * Add tests that ensures literal values are not sanitized in dev * Use `{color:false,depth:null}` options for formatting everywhere * Prettier format * Fix property name typo `color`->`colors` and helper function call * Move changelog entries from added to changed section --------- Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> * fix: GraphiQL Explorer Plugin CDN URL (#101) * Fix GraphiQL explorer plugin CDN URL * Add changelog entry * prepare 0.6.1 hotfix (#102) * prepare 0.6.1 hotfix * 0.6.1 in package.json --------- Co-authored-by: Marcel Schwarz <marcel.schwarz@sap.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following changes
Explanation:
GET /graphiqlwould logGET undefinedwhich was confusing.operationNameit was impossible to know which query was executed when the payload contains more than one query.Example
Query:
with variables:
{ "filter": { "ID": { "ge": 250 } } }and
Previous log output
New log output
During development:
In production: