def register_thread_logging_prefix(message: Optional[str]) -> None:
"""A function that allows a thread to register a string that
should be prepended to every log message it produces from now on.
- Relies on the :class:`MillisecondAwareOptionallyPrependingFormatter`
+ Relies on the :class:`MillisecondAwareOptionallyAugmentingFormatter`
being used with the logging Handler which is the default if you're
using this module.
def register_thread_logging_suffix(message: Optional[str]) -> None:
"""A function that allows a thread to register a string that
should be appended to every log message it produces from now on.
- Relies on the :class:`MillisecondAwareOptionallyPrependingFormatter`
+ Relies on the :class:`MillisecondAwareOptionallyAugmentingFormatter`
being used with the logging Handler which is the default if you're
using this module.
del LOGGING_SUFFIXES_BY_PIDTID[pidtid]
-class MillisecondAwareOptionallyPrependingFormatter(logging.Formatter):
+class MillisecondAwareOptionallyAugmentingFormatter(logging.Formatter):
"""A formatter for adding milliseconds to log messages which, for
whatever reason, the default Python logger doesn't do.
@overrides
def formatTime(self, record, datefmt=None):
- ct = MillisecondAwareOptionallyPrependingFormatter.converter(
+ ct = MillisecondAwareOptionallyAugmentingFormatter.converter(
record.created, pytz.timezone("US/Pacific")
)
if datefmt:
assert facility is not None
handler = SysLogHandler(facility=facility, address="/dev/log")
handler.setFormatter(
- MillisecondAwareOptionallyPrependingFormatter(
+ MillisecondAwareOptionallyAugmentingFormatter(
fmt=fmt,
datefmt=config.config["logging_date_format"],
)
backupCount=backup_count,
)
handler.setFormatter(
- MillisecondAwareOptionallyPrependingFormatter(
+ MillisecondAwareOptionallyAugmentingFormatter(
fmt=fmt,
datefmt=config.config["logging_date_format"],
)
if config.config["logging_console"]:
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(
- MillisecondAwareOptionallyPrependingFormatter(
+ MillisecondAwareOptionallyAugmentingFormatter(
fmt=fmt,
datefmt=config.config["logging_date_format"],
)