Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
or '%f' in formatter_options['datefmt']):
pattern = parser.get_pattern('asctime')
replacements = {'%': '%(msecs)03d', '{': '{msecs:03}', '$': '${msecs}'}
formatter_options['fmt'] = pattern.sub(
r'\g<0>,' + replacements[style],
formatter_options['fmt'],
)
# Do we need to make %(hostname) available to the formatter?
HostNameFilter.install(
fmt=formatter_options['fmt'],
handler=handler,
style=style,
use_chroot=kw.get('use_chroot', True),
)
# Do we need to make %(programname) available to the formatter?
ProgramNameFilter.install(
fmt=formatter_options['fmt'],
handler=handler,
programname=kw.get('programname'),
style=style,
)
# Do we need to make %(username) available to the formatter?
UserNameFilter.install(
fmt=formatter_options['fmt'],
handler=handler,
username=kw.get('username'),
style=style,
)
# Inject additional formatter arguments specific to ColoredFormatter?
if use_colors:
for name, environment_name in (('field_styles', 'COLOREDLOGS_FIELD_STYLES'),
('level_styles', 'COLOREDLOGS_LEVEL_STYLES')):