-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
add console-error to the Logger class #7125
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
bump |
Hi @pmario I notice that the new But I'm concerned at a deeper level at the proliferation of similar but different debugging methods. What is the underlying problem you want to solve? If it is to add colour to log messages I'd rather we approached that by trying to make the browser and server more compatible in that regard.
I don't quite understand. Are you suggesting that there are places in the core that we need to add error trapping and use this proposed new method? |
I did search the whole code-base and There is no info about the "args" in the Since the existing logger is unable to create a console.error() it was the only thing the new function should do. So I implemented it that way. I could have added a new parameter to the |
No I wanted to have a log function for plugins to call if an error message should be logged to the console in the same way plugins can use the .log() method. .. Without he RSOD |
This PR allows the Logger class to use
console.error()
... sinceconsole.log()
doesn't add any color to messages in the browser dev-console.This is needed, if a core function throws an error and there is a
try/catch
function. If possible thecatch()
function should avoid data corruption.There is a
$tw.utils.error()
function which would write a message to the browser console. BUT it also creates the RSOD info. .. So it's not usable.$tw.utils.log()
is not usable for my usecase, since it's not visible enough.An alternative would be to create global
$tw.utils.errorToConsole()
utility function. .. BUT I think the implementation in the PR is more versatile.If the PR is merged I'll add some docs to the tiddlywiki.com/dev edition. ... Because messing around with the naming inconsistencies did cost me 3 hours.
So investing 2 more to create some docs about what I learned IMO would be OK