MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / log

Method log

lib/sqlalchemy/log.py:185–210  ·  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

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