mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
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.
This commit is contained in:
parent
9e8d6bbe24
commit
303618c7e1
@ -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()])
|
||||
|
Loading…
Reference in New Issue
Block a user