MCPcopy
hub / github.com/benoitc/gunicorn / MockLogger

Class MockLogger

benchmarks/dirty_benchmark.py:159–189  ·  view source on GitHub ↗

Mock logger for standalone testing.

Source from the content-addressed store, hash-verified

157
158
159class MockLogger:
160 """Mock logger for standalone testing."""
161
162 def __init__(self, verbose: bool = False):
163 self.verbose = verbose
164
165 def debug(self, msg, *args):
166 if self.verbose:
167 print(f"[DEBUG] {msg % args if args else msg}")
168
169 def info(self, msg, *args):
170 if self.verbose:
171 print(f"[INFO] {msg % args if args else msg}")
172
173 def warning(self, msg, *args):
174 print(f"[WARN] {msg % args if args else msg}")
175
176 def error(self, msg, *args):
177 print(f"[ERROR] {msg % args if args else msg}")
178
179 def critical(self, msg, *args):
180 print(f"[CRIT] {msg % args if args else msg}")
181
182 def exception(self, msg, *args):
183 print(f"[EXC] {msg % args if args else msg}")
184
185 def reopen_files(self):
186 pass
187
188 def close_on_exec(self):
189 pass
190
191
192class IsolatedBenchmark:

Callers 1

startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected