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
Added feature to exclude entries from being logged (e.g. sensitive data) #16
Conversation
So You get the extra |
As I added another test for completion I uncovered an existing bug which was duplicating all tags in the mapped object. |
This looks nice so far. Can you add some documentation? Also, just to verify, this doesn't looks like a breaking change... |
Not a breaking change. The emphasis is still on the inclusion of tag. Will update the documentation! |
@arb I did notice in your documentation (example) you actually described what I considered to be a bug: Was this intended? |
Also, seems I'm wrong about the breaking change. :-) It IS a breaking if we considering projects using the subscription function directly, which is now returning a different type of object (include/exclude object). Though I expect the amount of people using this is limited? |
You know what, I'll make that bit backwards compatible as well. ;-) |
Fully backwards compatible now, including subscription. |
Readme updated. |
Thanks for the work @benleen |
Are we just rolling the dice that people aren't using "include" and "exclude" as existing filtering tags? As far as repetition of tags... not sure what that was there for of it was a typo. That being said, duplicate tags shouldn't have any impact on the filtering right? |
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.
Can you run npm outdated
while you're in there and bump the versions of the dependencies.
@@ -17,7 +17,7 @@ good-squeeze is a collection of small transform streams. The `Squeeze` stream is | |||
|
|||
Creates a new Squeeze transform stream where: | |||
|
|||
- `events` an object where each key is a valid good event, and the value is a string or array of strings representing event tags. "\*" indicates no filtering. `null` and `undefined` are assumed to be "\*". Defaults to `{}` | |||
- `events` an object where each key is a valid good event, and the value is a string, array of strings representing event tags to include or an object defining tags to include and/or exclude. "\*" indicates all tags match. `null` and `undefined` are assumed to be "\*". Defaults to `{}` |
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.
Can you show an example of the different ways to configure these events... surrounding include
and exclude
would help highlight the fact that they are keywords in an object.
if (subEventTags.exclude.indexOf(eventTag) > -1) { | ||
return false; | ||
} | ||
result = result || subEventTags.include.indexOf(eventTag) > -1 || subEventTags.include.length === 0; |
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.
Are you using include.length
of 0
to mean don't filter anything and include every event, regardless of tag?
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.
Yes, this is consistent with how the previous 'include' string array was being interpreted:
https://github.com/hapijs/good-squeeze/blob/master/lib/squeeze.js#L59
To be sure: I was talking about all tags being doubled out in the subscription result. Which seems obsolete. The validation logic will also loop through all Will look at dependencies. |
Package Current Wanted Latest Location
code 2.3.0 2.3.0 3.0.2 good-squeeze
fast-safe-stringify 1.0.9 1.0.9 1.1.0 good-squeeze
hoek 3.0.4 3.0.4 4.0.2 good-squeeze
lab 10.9.0 10.9.0 11.0.1 good-squeeze |
I see what you mean with people using I do wonder if anyone was using the filter or subscription with anything else but a string or array of strings (as the tests were assuming). That being said though, if we want to be semantically correct we could release it as a breaking change. |
@@ -17,7 +17,7 @@ good-squeeze is a collection of small transform streams. The `Squeeze` stream is | |||
|
|||
Creates a new Squeeze transform stream where: | |||
|
|||
- `events` an object where each key is a valid good event, and the value is a string or array of strings representing event tags. "\*" indicates no filtering. `null` and `undefined` are assumed to be "\*". Defaults to `{}` | |||
- `events` an object where each key is a valid good event, and the value is a string, array of strings representing event tags to include or an object defining tags to `include` and/or `exclude`. "\*" indicates all tags match. `null` and `undefined` are assumed to be "\*". Defaults to `{}` |
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.
@arb About the examples. It didn't seem right to inline them here, so as you noticed I added an example a bit down in this readme next to the other one. Should I add an example or context (similar to my initial comments) on the filter function instead?
Right now the tests are telling the story about how the subscription is interpreted.
I've updated the readme though I'm not to happy with it either.. Maybe less is more? I'm new to writing this kind of documentation, suggestions are welcome! |
## Methods | ||
|
||
### `Squeeze(events, [options])` | ||
|
||
Creates a new Squeeze transform stream where: | ||
|
||
- `events` an object where each key is a valid good event, and the value is a string or array of strings representing event tags. "\*" indicates no filtering. `null` and `undefined` are assumed to be "\*". Defaults to `{}` | ||
- `events` an object where each key is a valid good event, defaults to `{}`. The value which can be one of the following types representing tags to filter |
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.
Maybe word this something like...
events
an object where each key is a valid good event and the value is one of the following:string
- a tag to include when filtering.'*'
indicates no filtering.array
- an array of tags to include when filtering.[]
indicates no filtering.object
- an object with the following valuesinclude
- string or array representing tag(s) to include when filteringexclude
- string or array representing tag(s) to exclude when filtering.exclude
takes precedence over anyinclude
tags.
I've decided to just make this a breaking change... In that case we may want to just change the API to always pass an object of
Then this will be ready to land. Thanks a lot! |
Sounds good! |
Updated dependencies. Reason tests were updated: |
Should be good now. Apologies for the force pushes (just wanted to keep the commits a bit cleaner). |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Hey arb! Had discussed this with @Marsup a while back:
Additional feature to exclude log entries from making it through to being logged.