log_levels_by_target={
"debug_target": LogLevel.DEBUG,
},
message_regex_filters=(),
)
with temporary_dir() as tmpdir:
setup_logging_to_file(LogLevel.INFO, log_dir=tmpdir)
After Change
)
// Do not set up a stdio destination, meaning that all messages will go to the log.
global_bootstrap_options = ob.bootstrap_options.for_global_scope()
with initialize_stdio(global_bootstrap_options):
native_engine.write_log(
msg="log msg one", level=LogLevel.INFO.level, target="some.target"
)
native_engine.write_log(
msg="log msg two", level=LogLevel.DEBUG.level, target="some.other.target"
)
native_engine.write_log(
msg="log msg three", level=LogLevel.DEBUG.level, target="debug_target"
)
loglines = (
Path(global_bootstrap_options.pants_workdir, "pants.log").read_text().splitlines()
)
assert "[INFO] log msg one" in loglines[0]