Proposal: Remove logging from Solid UI and add it as a module that is exposed through the data browser
See original GitHub issueI’m currently working on the log module, which exposes a set of methods that mostly do one of three things, depending on the environment:
- if the environment has the document object (e.g. is a browser), it will look for an element with id “status” and append lines to it with time, type of log message and the message whenever the methods are called with a message, or
- if the environment supports console (e.g. Node), it will use console.log to output the messages, or
- do nothing
(The other methods that do not log messages are various configuration methods.)
I think it’s weird that the module is dependent on a global element somehow being available, and think it would be better to expose the API through a module that is exposed through the data browser, probably through the DataBrowserContext interface that is made available to views through methods such as render. (It is currently defined in pane-registry.)
Data browser implementations would handle logging differently, but expose the same API. This module could then be passed to methods in Solid UI that requires logging, making the need for log module in Solid UI obsolete.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)

Top Related StackOverflow Question
I’m not implying that they should manipulate a global DOM element. I’m just saying they should not be exist in the way they exist now. In other words, I think we should activate https://eslint.org/docs/rules/no-console - I think we agree on that goal, right?
So then a simple solution is to add a function that we can call instead of it.
As a straw-man, I quickly did that here: https://github.com/solid/solid-ui/pull/267
But let’s discuss it at Monday’s standup, sounds like you’re blocked on it but I don’t think I really understand what your question is.
Environment setting, yes, global setting via the global scope, no. There are ways to work around these limitations, and good reasons for having them.
I would agree with this if it where not for the current weird behavior of log module doing DOM manipulation (hence this issue). Centralizing all
console.logwould probably be overkilling it, since I suspect a lot of them are not intended from the developers side to manipulate a global DOM element.