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

feat: scope inheritance support + tests + global #23

Merged
merged 2 commits into from
Oct 4, 2018

Conversation

pimlie
Copy link
Contributor

@pimlie pimlie commented Sep 26, 2018

fix: also assign consola to global

As consola was not assigned to the global scope by default, the 'require twice' test failed.

feat: allow runtime set scope

If you want all consola statements, also in other modules, to use a scope you cannot use withScope as that returns a new consola instance. If you try to set that new consola instance to global then it doesnt work for all modules (both internal as external) that where already imported.
By adding this.scope to the Object.assign you can just override the scope by importing consola and then setting consola.scope = 'my new scope' during runtime. Eg in nuxt-generate-cluster I want to set the scope to eg 'worker 1' for the first worker etc. But without this feat I have to set the scope in each of my modules again, and then still the consola statements from within Nuxt are logged without a scope.

feat: add require tests for custom consola

This is also in regards to https://cmty.app/nuxt/consola/issues/c35

pimlie and others added 2 commits September 26, 2018 11:44
feat: allow runtime set scope

feat: add require tests for custom consola
@pi0 pi0 merged commit 67b56a3 into unjs:master Oct 4, 2018
pi0 pushed a commit that referenced this pull request Oct 4, 2018
also adds ability to access consola using global object

also adds jest tests
pi0 pushed a commit that referenced this pull request Oct 4, 2018
also:
- add ability to access consola using global object
- add jest tests
@pi0 pi0 changed the title add a fix, a feature and a test feat: scope inheritance support + tests + global Oct 4, 2018
@pi0
Copy link
Member

pi0 commented Oct 4, 2018

Thanks @pimlie ❤️

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

Successfully merging this pull request may close these issues.

2 participants