Closed
Description
hierarchicalLoggingEnabled
, recordStackTraceAtLevel
, _rootLevel
(and also the _loggers
static field) are all global which makes testing code that uses global loggers difficult.
A solution could be to use expandos that are keyed to a zone environment variable for the 'global' logging state. This would make it easy to decouple tests.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
natebosch commentedon Mar 12, 2020
I worry that making these variables, which are already confusing and hard to reason about, zone level concepts we are just making things harder for ourselves.
See #441
If anything I think we should consider an entire overhaul of the API which doesn't suffer from these global impacts. Within that design we should certainly consider whether having some sort of zone scoped
log
variable would be useful - that's what we do inpackage:build
and it has been working well for us. https://pub.dev/documentation/build/latest/build/log.htmlClosing for now since I don't think we plan on addressing this with the current design.