Replies: 1 comment
-
Im wondering why this feature request didn't get more traction, that seems like that can be a common concern |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Current situation
We currently have the
Console
standard implemented, but we don't implement it with the commonLogger
,Printer
andFormatter
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, theconsole
will work as it does now, but we should have a way of creating theconsole
object to use a customPrinter
.How do we do this?
We should have a
printer
object that implements thePrinter
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 usesWrite
to write to a log file.What I'm not very sure is on what the
options
should be in thePrinter
. Maybe we can just skip that argument for now.Beta Was this translation helpful? Give feedback.
All reactions