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

Logging via format string no longer works, advice please #72

Open
toddb opened this issue Oct 5, 2021 · 1 comment
Open

Logging via format string no longer works, advice please #72

toddb opened this issue Oct 5, 2021 · 1 comment

Comments

@toddb
Copy link

toddb commented Oct 5, 2021

@Download in version one, I could write a positional string formatter.

log.debug('setting return-url: %s', uri);

Now, it seems the default is to use template strings (presumably kurly);

log.debug(`setting return-url: ${uri}`);

With my old format, I now get

image

I can't quite grok how to swap back to the original format. Is is possible?

Cheers

ps I have been sitting on this change for quite a while and only now trying to address it.

@Download
Copy link
Owner

Download commented Apr 2, 2022

@toddb Sorry for the late response.
Ulog v1 did not support formatters. The formatting syntax you were using is actually console native. Because ulog did not do any formatting of it's own, you could use the positional formatters and they just worked.
Ulog v2 supports colored / formatted output. This uses (abuses) some features of the console. One of which is to rely on positional formatters for the colors and on Function.apply to not disturb the call stack. To support formats this way actually messes with the positional formats.
Please try to set colors and align off and to not use any formats. My guess is you will get the old behavior back. I think that if you use a dynamic format, you will also get the old behavior. But using colors / align / a static format (that does not mess up the callstack) probably messes up positional formatting.... Please do some testing with these settings and let me know what you found.

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

No branches or pull requests

2 participants