Skip to content

Attempt to fix #1577.#1579

Merged
indexzero merged 4 commits into
masterfrom
gh-1577
Jan 29, 2019
Merged

Attempt to fix #1577.#1579
indexzero merged 4 commits into
masterfrom
gh-1577

Conversation

@indexzero
Copy link
Copy Markdown
Member

@indexzero indexzero commented Jan 29, 2019

@kibertoad not an expert on prototypal semantics through Object.create, but I grok most of what the issue is. I haven't 100% solved it, and I'm (frankly) not satisfied with re-creating the convenience methods for levels (e.g. .info, etc) for each .child() call, but I don't see a way around it.

Also played around with what's the most performant way to set the helpers in this jsperf for anyone interested.

Only one test is failing, but that's somewhat obvious since it's using Object.create.

Noticed that your branch did not pass CI either. Thoughts?

UPDATE: current implementation supports both unbound, stateless functions and Object.create(logger, props) scenarios. The underlying implementation is ... let's say unusual ... but I ran it against pino benchmarks and there was no material degradation in performance.

cc/ @DABH

@indexzero indexzero requested review from DABH and jcrugzz January 29, 2019 05:27
@indexzero indexzero changed the title [WIP] Attempt to fix #1577. Attempt to fix #1577. Jan 29, 2019
@indexzero
Copy link
Copy Markdown
Member Author

@soldair any thoughts on this? The regression itself was introduced in #1483 – hoping you may know a better / more elegant way to achieve the same goals.

@indexzero indexzero added Bug Important Help Wanted Additional help desired from the community labels Jan 29, 2019
@soldair
Copy link
Copy Markdown
Contributor

soldair commented Jan 29, 2019

I'll review it first thing tomorrow. Thanks for the ping

Copy link
Copy Markdown
Contributor

@DABH DABH left a comment

Choose a reason for hiding this comment

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

Tests look good. Seems like the key thing is to use functions instead of arrow functions in the appropriate places due to the different binding behaviors, which makes sense -- don't think this is too unusual :)

@indexzero indexzero merged commit ce7c951 into master Jan 29, 2019
@indexzero indexzero deleted the gh-1577 branch January 29, 2019 18:31
Mizumaki pushed a commit to Mizumaki/winston that referenced this pull request Jun 11, 2020
* [fix wip] Attempt to fix winstonjs#1577.

* [fix test] Fallback to the "root" instance **always** created by `createLogger` for level convenience methods (e.g. `.info()`, `.silly()`).

* [tiny] Remove useless assignment.

* [tiny] DRY it up a little.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Help Wanted Additional help desired from the community Important

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants