-
Notifications
You must be signed in to change notification settings - Fork 108
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
Formatting example breaks console substition #106
Comments
Thanks for raising this issue. Do you have a suggested fix?
Jonny
…On Thu, 10 Jun 2021, 08:46 biergit, ***@***.***> wrote:
formatter: function (messages, context) {
// prefix each log message with a timestamp.
messages.unshift(new Date().toUTCString());
},
});
will break: logger.log('Hello %s', 'Jonny')
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#106>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQ36LX7IZ2QM66YJ7GXHTTSBUWRANCNFSM46NRGWGA>
.
|
Sorry, I am no JS expert. This is what I did:
It also feels surprising that messages here is not an array but an |
Why?The |
Pull requests welcome!
…On Sat, 18 Dec 2021, 13:06 Hyro, ***@***.***> wrote:
Thanks for raising this issue. Do you have a suggested fix? Jonny
… <#m_8893153787719601507_>
On Thu, 10 Jun 2021, 08:46 biergit, *@*.***> wrote: formatter: function
(messages, context) { // prefix each log message with a timestamp.
messages.unshift(new Date().toUTCString()); }, }); will break:
logger.log('Hello %s', 'Jonny') — You are receiving this because you are
subscribed to this thread. Reply to this email directly, view it on GitHub <
#106 <#106>>, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AABQ36LX7IZ2QM66YJ7GXHTTSBUWRANCNFSM46NRGWGA
.
Why?
The console.log function parses these "variables" like %s only in the
first argument, and you put what you want in the formatters in the first
argument, and that's not good. The solution is that you add it to the null
element at the beginning in your own formatting handler.
—
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQ36KY2AC2YYBURZUVLR3URSBNXANCNFSM46NRGWGA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
It will be major change probably |
will break:
logger.log('Hello %s', 'Jonny')
The text was updated successfully, but these errors were encountered: