no longer show prefix
This commit is contained in:
@@ -83,8 +83,10 @@ def handle_io(
|
||||
return b""
|
||||
|
||||
# Extra information passed to the logger
|
||||
stdout_extra = {"command_prefix": prefix}
|
||||
stderr_extra = {"command_prefix": prefix}
|
||||
stdout_extra = {}
|
||||
stderr_extra = {}
|
||||
if prefix:
|
||||
stdout_extra["command_prefix"] = stderr_extra["command_prefix"] = prefix
|
||||
if msg_color and msg_color.stderr:
|
||||
stdout_extra["color"] = msg_color.stderr.value
|
||||
if msg_color and msg_color.stdout:
|
||||
@@ -267,9 +269,6 @@ def run(
|
||||
if options.cwd is None:
|
||||
options.cwd = Path.cwd()
|
||||
|
||||
if options.prefix is None:
|
||||
options.prefix = "$"
|
||||
|
||||
if options.input:
|
||||
if any(not ch.isprintable() for ch in options.input.decode("ascii", "replace")):
|
||||
filtered_input = "<<binary_blob>>"
|
||||
|
||||
@@ -25,12 +25,9 @@ class PrefixFormatter(logging.Formatter):
|
||||
print errors in red and warnings in yellow
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, trace_prints: bool = False, default_prefix: str | None = None
|
||||
) -> None:
|
||||
def __init__(self, trace_prints: bool = False) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.default_prefix = default_prefix
|
||||
self.trace_prints = trace_prints
|
||||
self.hostnames: list[str] = []
|
||||
self.hostname_color_offset = 0
|
||||
@@ -51,7 +48,7 @@ class PrefixFormatter(logging.Formatter):
|
||||
msg_color = AnsiColor.DEFAULT.value
|
||||
|
||||
# If extra["command_prefix"] is set, use that as the logging prefix.
|
||||
command_prefix = getattr(record, "command_prefix", self.default_prefix)
|
||||
command_prefix = getattr(record, "command_prefix", None)
|
||||
|
||||
# If color is disabled, don't use color.
|
||||
if DISABLE_COLOR:
|
||||
@@ -154,7 +151,6 @@ def print_trace(msg: str, logger: logging.Logger, prefix: str | None) -> None:
|
||||
def setup_logging(
|
||||
level: Any,
|
||||
root_log_name: str = __name__.split(".")[0],
|
||||
default_prefix: str = "clan",
|
||||
) -> None:
|
||||
# Get the root logger and set its level
|
||||
main_logger = logging.getLogger(root_log_name)
|
||||
@@ -166,5 +162,5 @@ def setup_logging(
|
||||
# Create and add your custom handler
|
||||
default_handler.setLevel(level)
|
||||
trace_prints = bool(int(os.environ.get("TRACE_PRINT", "0")))
|
||||
default_handler.setFormatter(PrefixFormatter(trace_prints, default_prefix))
|
||||
default_handler.setFormatter(PrefixFormatter(trace_prints))
|
||||
main_logger.addHandler(default_handler)
|
||||
|
||||
Reference in New Issue
Block a user