@@ -39,14 +39,18 @@ def setup_event_logger(flags, callbacks: List[Callable[[EventMsg], None]] = [])
3939 else :
4040 if flags .LOG_LEVEL != "none" :
4141 line_format = _line_format_from_str (flags .LOG_FORMAT , LineFormat .PlainText )
42- log_level = EventLevel .DEBUG if flags .DEBUG else EventLevel (flags .LOG_LEVEL )
42+ log_level = (
43+ EventLevel .ERROR
44+ if flags .QUIET
45+ else EventLevel .DEBUG
46+ if flags .DEBUG
47+ else EventLevel (flags .LOG_LEVEL )
48+ )
4349 console_config = _get_stdout_config (
4450 line_format ,
45- flags .DEBUG ,
4651 flags .USE_COLORS ,
4752 log_level ,
4853 flags .LOG_CACHE_EVENTS ,
49- flags .QUIET ,
5054 )
5155 EVENT_MANAGER .add_logger (console_config )
5256
@@ -81,11 +85,9 @@ def _line_format_from_str(format_str: str, default: LineFormat) -> LineFormat:
8185
8286def _get_stdout_config (
8387 line_format : LineFormat ,
84- debug : bool ,
8588 use_colors : bool ,
8689 level : EventLevel ,
8790 log_cache_events : bool ,
88- quiet : bool ,
8991) -> LoggerConfig :
9092
9193 return LoggerConfig (
@@ -97,8 +99,6 @@ def _get_stdout_config(
9799 filter = partial (
98100 _stdout_filter ,
99101 log_cache_events ,
100- debug ,
101- quiet ,
102102 line_format ,
103103 ),
104104 output_stream = sys .stdout ,
@@ -107,16 +107,11 @@ def _get_stdout_config(
107107
108108def _stdout_filter (
109109 log_cache_events : bool ,
110- debug_mode : bool ,
111- quiet_mode : bool ,
112110 line_format : LineFormat ,
113111 msg : EventMsg ,
114112) -> bool :
115- return (
116- (msg .info .name not in ["CacheAction" , "CacheDumpGraph" ] or log_cache_events )
117- and (EventLevel (msg .info .level ) != EventLevel .DEBUG or debug_mode )
118- and (EventLevel (msg .info .level ) == EventLevel .ERROR or not quiet_mode )
119- and not (line_format == LineFormat .Json and type (msg .data ) == Formatting )
113+ return (msg .info .name not in ["CacheAction" , "CacheDumpGraph" ] or log_cache_events ) and not (
114+ line_format == LineFormat .Json and type (msg .data ) == Formatting
120115 )
121116
122117
@@ -147,11 +142,9 @@ def _get_logbook_log_config(
147142) -> LoggerConfig :
148143 config = _get_stdout_config (
149144 LineFormat .PlainText ,
150- debug ,
151145 use_colors ,
152- EventLevel .DEBUG if debug else EventLevel .INFO ,
146+ EventLevel .ERROR if quiet else EventLevel . DEBUG if debug else EventLevel .INFO ,
153147 log_cache_events ,
154- quiet ,
155148 )
156149 config .name = "logbook_log"
157150 config .filter = (
@@ -183,7 +176,7 @@ def cleanup_event_logger():
183176EVENT_MANAGER .add_logger (
184177 _get_logbook_log_config (False , True , False , False ) # type: ignore
185178 if ENABLE_LEGACY_LOGGER
186- else _get_stdout_config (LineFormat .PlainText , False , True , EventLevel .INFO , False , False )
179+ else _get_stdout_config (LineFormat .PlainText , True , EventLevel .INFO , False )
187180)
188181
189182# This global, and the following two functions for capturing stdout logs are
0 commit comments