You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement an easily replaceable Printer for console #551
A-APIChanges related to public APIsA-EnhancementNew feature or requestC-BuiltinsPRs and Issues related to builtins/intrinsicsR-DiscussionIssues needing more discussion
Current situation
We currently have the Console standard implemented, but we don't implement it with the common Logger, Printer and Formatter operations. This prevents crates using Boa from creating their own printers that will for example not print anything but save the result to a file or a database.
Proposed feature
We should implement an easily replaceable Printer that would either be passed to the Realm / Interpreter, so that by default, the console will work as it does now, but we should have a way of creating the console object to use a custom Printer.
How do we do this?
We should have a printer object that implements the Printer trait, which would be something like:
Maybe the trait needs to be modified, and we would need a LogLevel enum, but I think the implementation should go in this direction. The idea behind having the logger use &mut self is because we might want a printer that stores the logs in memory, or in a buffer, or that uses Write to write to a log file.
What I'm not very sure is on what the options should be in the Printer. Maybe we can just skip that argument for now.
changed the title [-]Implement an easily replaceable Logger, Printer and Formatter for `console`[/-][+]Implement an easily replaceable Printer for `console`[/+]on Jul 8, 2020
A-APIChanges related to public APIsA-EnhancementNew feature or requestC-BuiltinsPRs and Issues related to builtins/intrinsicsR-DiscussionIssues needing more discussion
Activity
[-]Implement an easily replaceable Logger, Printer and Formatter for `console`[/-][+]Implement an easily replaceable Printer for `console`[/+]