Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Allow custom ignored namespaces in backtrace processor #83

Merged
merged 5 commits into from
Aug 23, 2019

Conversation

adam-ja
Copy link
Contributor

@adam-ja adam-ja commented Jan 17, 2018

The backtrace processor adds the file, line, class, and function
responsible for triggering a log to the event extras.

By default, classes in the backtrace under the Zend\Log namespace are
ignored so that we can see the actual application code that called the
log().

However, there might also be cases when we want to ignore other
namespaces so that we get the true origin. The example I came across
that prompted this patch was Psr\Log, which appears when the
PsrLoggerAdapter wraps the underlying Zend Logger.

This patch allows us to add our own custom ignored namespaces in
addition to the default Zend\Log.

@adam-ja adam-ja changed the base branch from master to develop January 17, 2018 16:31
@adam-ja adam-ja force-pushed the custom-backtrace-ignore branch from 9e363be to fbdca4c Compare January 17, 2018 16:32
@weierophinney
Copy link
Member

This looks like a great feature!

Can you please also add documentation (under the doc/book/ tree) detailing the new methods and options?

Thanks!

weierophinney and others added 3 commits April 10, 2018 12:11
The backtrace processor adds the file, line, class, and function
responsible for triggering a log to the event extras.

By default, classes in the backtrace under the Zend\Log namespace are
ignored so that we can see the actual application code that called the
log().

However, there might also be cases when we want to ignore other
namespaces so that we get the true origin. The example I came across
that prompted this patch was Psr\Log, which appears when the
PsrLoggerAdapter wraps the underlying Zend Logger.

This patch allows us to add our own custom ignored namespaces in
addition to the default Zend\Log.
@adam-ja adam-ja force-pushed the custom-backtrace-ignore branch from 6d0e5e5 to 4206b8c Compare April 29, 2018 15:34
@adam-ja
Copy link
Contributor Author

adam-ja commented Apr 29, 2018

Docs added - sorry for the delay.

There's really nothing to say about getIgnoredNamespaces() as there's probably not a great deal of use for it beyond testing/debugging.

src/Processor/Backtrace.php Outdated Show resolved Hide resolved
Adam Auskerin added 2 commits December 5, 2018 15:36
Ignored namespaces are not expected to change once a processor is
created so it makes more sense to have this as a constructor option
rather than a separate function that allows the processor to be
reconfigured after creation.
michalbundyra added a commit that referenced this pull request Aug 23, 2019
Allow custom ignored namespaces in backtrace processor
michalbundyra added a commit that referenced this pull request Aug 23, 2019
@michalbundyra michalbundyra merged commit 7f6c633 into zendframework:develop Aug 23, 2019
michalbundyra added a commit that referenced this pull request Aug 23, 2019
@michalbundyra
Copy link
Member

Thanks, @adam-ja!

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

Successfully merging this pull request may close these issues.

4 participants