MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / log

Method log

lib/sqlalchemy/log.py:180–205  ·  view source on GitHub ↗

Delegate a log call to the underlying logger. The level here is determined by the echo flag as well as that of the underlying logger, and logger._log() is called directly.

(self, level: int, msg: str, *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

178 self.log(logging.CRITICAL, msg, *args, **kwargs)
179
180 def log(self, level: int, msg: str, *args: Any, **kwargs: Any) -> None:
181 """Delegate a log call to the underlying logger.
182
183 The level here is determined by the echo
184 flag as well as that of the underlying logger, and
185 logger._log() is called directly.
186
187 """
188
189 # inline the logic from isEnabledFor(),
190 # getEffectiveLevel(), to avoid overhead.
191
192 if self.logger.manager.disable >= level:
193 return
194
195 selected_level = self._echo_map[self.echo]
196 if selected_level == logging.NOTSET:
197 selected_level = self.logger.getEffectiveLevel()
198
199 if level >= selected_level:
200 if STACKLEVEL:
201 kwargs["stacklevel"] = (
202 kwargs.get("stacklevel", 1) + STACKLEVEL_OFFSET
203 )
204
205 self.logger._log(level, msg, args, **kwargs)
206
207 def isEnabledFor(self, level: int) -> bool:
208 """Is this logger enabled for level 'level'?"""

Callers 7

debugMethod · 0.95
infoMethod · 0.95
warningMethod · 0.95
errorMethod · 0.95
exceptionMethod · 0.95
criticalMethod · 0.95
apply_pytest_optsFunction · 0.80

Calls 3

getEffectiveLevelMethod · 0.80
_logMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected