Skip to content
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

Feature Request: costume response/request filter function #220

Closed
vim-daniel opened this issue Sep 1, 2019 · 1 comment
Closed

Feature Request: costume response/request filter function #220

vim-daniel opened this issue Sep 1, 2019 · 1 comment

Comments

@vim-daniel
Copy link

vim-daniel commented Sep 1, 2019

I've came across the need to have parts of my response body written to the log,
currently this library supports all or nothing, with dot notation support it will improve greatly as I will be able to pick specific parts of the body to log, but dot notation is not enough,
I have for example a response body that contains an array of big objects and frankly I only want their ids to be logged, with dot notation that's impossible unfortunately.

It would be extremely helpful to control the response object that's gonna be written to the log
at first i thought that requestFilter and responseFilter were exposed precisely for that,
but they only control properties of the object, I propose changing these functions implementations (or deprecating them and creating new functions) that will be given the full object and their return value will be the object that will be written to the log

@yinzara
Copy link
Collaborator

yinzara commented Mar 1, 2020

The library has a "dynamicMeta" function option that if specified allows you to add arbitrary metadata programmatically to the log entry. See the "index.d.ts" for the signature but it's basically a function that takes in two arguments, the express request and express response and if it returns an object, its fields get added to the log entry metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants