diff options
author | Stefan Hertrampf <stefan.hertrampf@cyberus-technology.de> | 2024-04-09 11:20:29 +0200 |
---|---|---|
committer | Stefan Hertrampf <stefan.hertrampf@cyberus-technology.de> | 2024-05-07 15:17:17 +0200 |
commit | 303618c7e12f002f3c6ce35013c09ae5ac8f69e9 (patch) | |
tree | 798b3096ee6348df24e0adde2ce4151826db85da /nixos | |
parent | 9e8d6bbe2488d1305b276e3e0686c6ebee7eaba8 (diff) |
nixos/test-driver: enable XML log selectively
Previously, the XML logging was always present and only created an output file if a special environment variable was present. We now only create the XML logger if the environment variable is present, saving us from logging to XML internally if it is not required.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/test-driver/test_driver/logger.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/nixos/lib/test-driver/test_driver/logger.py b/nixos/lib/test-driver/test_driver/logger.py index ec1e25bf2db42..65cfa195dd1e7 100644 --- a/nixos/lib/test-driver/test_driver/logger.py +++ b/nixos/lib/test-driver/test_driver/logger.py @@ -224,9 +224,8 @@ class TerminalLogger(AbstractLogger): class XMLLogger(AbstractLogger): - def __init__(self) -> None: - self.logfile = os.environ.get("LOGFILE", "/dev/null") - self.logfile_handle = codecs.open(self.logfile, "wb") + def __init__(self, outfile: str) -> None: + self.logfile_handle = codecs.open(outfile, "wb") self.xml = XMLGenerator(self.logfile_handle, encoding="utf-8") self.queue: "Queue[Dict[str, str]]" = Queue() @@ -310,6 +309,4 @@ class XMLLogger(AbstractLogger): self.xml.endElement("nest") -terminal_logger = TerminalLogger() -xml_logger = XMLLogger() -rootlog: CompositeLogger = CompositeLogger([terminal_logger, xml_logger]) +rootlog: CompositeLogger = CompositeLogger([TerminalLogger()]) |