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

Allowing nested logs #4

Open
Berkmann18 opened this issue Nov 1, 2018 · 2 comments
Open

Allowing nested logs #4

Berkmann18 opened this issue Nov 1, 2018 · 2 comments

Comments

@Berkmann18
Copy link
Owner

Proposal

Being able to nest log functions.

Motivation

This would make it possible to use several styles in one log without having to use colors/chalk.

Use cases and examples

info('Some', debug('statement that', error('failed')));
@Berkmann18 Berkmann18 added this to the 1.2.0 or 2.0.0 milestone Nov 1, 2018
Berkmann18 added a commit that referenced this issue Nov 1, 2018
Added the possibility to colourise data without it being logged and thus allowing nested colouring

re #4
@Berkmann18
Copy link
Owner Author

Thus far, I found an okay-ish way with use but couldn't figure out how to get those functions to know when not to use log (but the execution goes from inside out so the parent callee functions wouldn't know if it was first called with fellow functions).

@Berkmann18
Copy link
Owner Author

What about having each function assume they are nested so return the coloured data without logging anything then if there are no further levels in the call stack it will be logged.

The potential problem with that is that it will rely on a function that will, at a later stage (before the whole statement is completely read) know what needs to be passed to a log and what doesn't need to.

No idea how to do that.

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

No branches or pull requests

1 participant