diff options
author | William Deegan <bill@baddogconsulting.com> | 2022-10-22 00:16:13 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2022-10-22 00:16:13 (GMT) |
commit | 20ffb3e37f8b46ef232c28e32006294e4d513e3e (patch) | |
tree | 844f153e6886e52ef92014b4fcfda933275ca27e /SCons/Util.py | |
parent | b23bbee1bfcffab6c22f6d32689a16c093a983d3 (diff) | |
download | SCons-20ffb3e37f8b46ef232c28e32006294e4d513e3e.zip SCons-20ffb3e37f8b46ef232c28e32006294e4d513e3e.tar.gz SCons-20ffb3e37f8b46ef232c28e32006294e4d513e3e.tar.bz2 |
Migrate Taskmaster tracing to use python logging
Diffstat (limited to 'SCons/Util.py')
-rw-r--r-- | SCons/Util.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/SCons/Util.py b/SCons/Util.py index 49a3a0f..476d4d6 100644 --- a/SCons/Util.py +++ b/SCons/Util.py @@ -35,6 +35,7 @@ from collections.abc import MappingView from contextlib import suppress from types import MethodType, FunctionType from typing import Optional, Union +from logging import Formatter # Note: Util module cannot import other bits of SCons globally without getting # into import loops. Both the below modules import SCons.Util early on. @@ -2159,6 +2160,17 @@ def wait_for_process_to_die(pid): else: time.sleep(0.1) +# From: https://stackoverflow.com/questions/1741972/how-to-use-different-formatters-with-the-same-logging-handler-in-python +class DispatchingFormatter(Formatter): + + def __init__(self, formatters, default_formatter): + self._formatters = formatters + self._default_formatter = default_formatter + + def format(self, record): + formatter = self._formatters.get(record.name, self._default_formatter) + return formatter.format(record) + # Local Variables: # tab-width:4 # indent-tabs-mode:nil |