Comments (12)
Indeed, summarizing IRC: Callers can provide something generic (kinda like the warning we provide in time()), but don't have to provide anything. And as you said we should make it clear that:
- The warning is purely advisory
- May be subject to localization (so should probably be general)
- In optional (if none is provided, this standard's algorithm could just display anything that indicates a warning)
from console.
Will be requesting review soon on a small PR to take care of this, would be great to get feedback; in Seattle this week so things are a tad hectic.
from console.
Yeah, if you read the spec I linked to, you can see no such requirements.
from console.
I like this idea, but wouldn't know where to begin in integrating it here.
from console.
So if you search through https://html.spec.whatwg.org/ (not the multipage version) for "developer console", it comes up a few times:
If the error is still not handled after this, then the error may be reported to a developer console.
(and several similar phrases in various points)
If any of the objects in transfer are the target port, if any, then let doomed be true, and optionally report to a developer console that the target port was posted to itself, causing the communication channel to be lost.
If the value doesn't compile successfully, user agents are encouraged to log this fact in a developer console, to aid debugging.
User agents are encouraged to log the precise cause in a developer console, to aid debugging.
(although that section will be going away soon per whatwg/html#1207)
If any value in a is not finite (e.g. an Infinity or a NaN value), or if any value is negative (less than zero), then abort these steps (without throwing an exception; user agents could show a message on a developer console, though, as that would be helpful for debugging).
I guess maybe you'd want to define a term like "optionally warn in the developer console" which is something like "Optionally, call Printer with "warn"
and a List containing an appropriate message string". Maybe also "log an exception in the developer console given a JavaScript object e" which is "call Printer with "error"
and a List containing e."
Then all the call sites could cross-link to these terms. It wouldn't be much different than today, but it would kind of emphasize that things all tie together---HTML's "developer console" and the console discussed in the Console Standard.
from console.
I should note that true warnings are impossible for Node.js to implement. We only have two channels available, stdout
and stderr
as dictated by external factors.
Currently warnings in Node.js go to stderr
.
from console.
Well, I'm not sure "impossible to implement" is quite the right term. You can implement the Printer however you please. E.g. you could prepend the logLevel before writing out the string, or use different colors, or whatever. (Or do nothing different between warn and error.) There's no requirement involving POSIX output streams in the spec.
from console.
Right, I meant in the regard to having them be a) just the output that user provided, and b) differentiable.
Perhaps the spec does/will not require those points?
from console.
This seems like a good idea and the more we reference vague hand-wavy warning-reporting things in the standard the more I want to do this. I propose we move forward with this by creating a report a console warning
or report a developer console warning
that both this specification and others can use. Callers of it can also use it optionally, such as: "optionally, report a developer console warning with the warning 'Blah blah blah'"
It should be an easy enough change that I'm happy to take on. Looks like it'll provide a good ROI when we and other specs want to handle warning-reporting things, especially if you do it a lot (this should keep things DRY).
from console.
We should probably leave the actual warning undefined. Instead the algorithm can say that it should be something appropriate and localized for the occasion. And it needs to be optional of course.
from console.
Ugh, finishing this off soon I promise, got blocked up with a bunch of stuff all at once.
from console.
@domfarolino How can I help?
from console.
Related Issues (20)
- window.onconsoleopen Event HOT 4
- Remove NOTES.md
- How to tabulate an object shown by console.dir? HOT 1
- Pushing on a group stack not defined HOT 2
- console.context() HOT 2
- console.memory
- Add integration hooks for WebDriver-BiDi HOT 3
- Handling of ANSI escape codes HOT 4
- Feature request: being able to update a already logged value HOT 5
- Feature request: Ability to switch on and off particular log type -> console.(INFO,WARN,ERROR,TRACE etc) HOT 1
- Define which methods should provide a stacktrace HOT 6
- Formatter algorithm does not handle having no format specifiers HOT 3
- feature request: add `console.color` HOT 2
- add `console.log` function to window, so we can use `log` direct! HOT 5
- console.json HOT 11
- What should `console.assert(false, { a: 1 })` print? HOT 8
- Deprecate groupCollapsed in favor of group and groupEnd
- Minor wording change in assert() definition HOT 7
- Changes in Logger() definition HOT 3
- Change in organization of the definition of Formatter() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from console.