Skip to content

Conversation

@ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Jul 16, 2020

Just like for ILogger we should have a version that has the app ID
pre-set for the context (unless overwritten) so that each log entry can
be traced back to the app that produced it.

This adds a decorator that does just this.

Next step will be to deprecate ILogger 😈 🔥 💣

Just like for ILogger we should have a version that has the app ID
pre-set for the context (unless overwritten) so that each log entry can
be traced back to the app that produced it.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Copy link
Collaborator

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I find array_merge a bit heavy given that the first array is always the same. !isset($context[app]) add app id would work as well.

@ChristophWurst
Copy link
Member Author

LGTM. I find array_merge a bit heavy given that the first array is always the same. !isset($context[app]) add app id would work as well.

Is that really slower? I've tried to test this a bit at https://3v4l.org/Y9Wd0/perf#output but the isset version was even a tad slower.

@kesselb
Copy link
Collaborator

kesselb commented Jul 16, 2020

LGTM. I find array_merge a bit heavy given that the first array is always the same. !isset($context[app]) add app id would work as well.

Is that really slower? I've tried to test this a bit at https://3v4l.org/Y9Wd0/perf#output but the isset version was even a tad slower.

I don't have a strong opinion on that ;) But your benchmark shows that isset is faster 🤔 (I usually add system and user time as per https://stackoverflow.com/a/556411).

@rullzer rullzer merged commit 3085cf7 into master Jul 16, 2020
@rullzer rullzer deleted the feature/scoped-psr-logger branch July 16, 2020 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants