L i!UdZddlmZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z d d l mZd d l mZd dlmZer dZerdnd ZndZdZe ddZe deedfZej.dZej2ej4k(rej7ej8d"dZeZde d<d#dZ!d$dZ"e ejFdfZ$GddZ%GddZ& d% d&dZ'Gd d!Z(y)'aLogging control and utilities. Control of logging for SA can be performed from the regular python logging module. The regular dotted module namespace is used, starting at 'sqlalchemy'. For class-level logging, the class name is appended. The "echo" keyword parameter, available on SQLA :class:`_engine.Engine` and :class:`_pool.Pool` objects, corresponds to a logger specific to that instance only. ) annotationsN)Any)Optional)overload)Set)Type)TypeVar)Union)py311)py38)LiteralTF_IT Identified)bounddebug sqlalchemyctjtj}|j tj d|j |y)Nz.%(asctime)s %(levelname)s %(name)s %(message)s)logging StreamHandlersysstdout setFormatter Formatter addHandler)loggerhandlers T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/log.py_add_default_handlerr :sC##CJJ/G JK gzSet[Type[Identified]]_logged_classescXt|ddxs|jdz|jzS)N_sqla_logger_namespace.)getattr __module____name__)clss r_qual_logger_name_for_clsr*Es.-t4 / >>C #,, .r!ctjt|fd|_fd|_|_t j||S)NcBjtjSN) isEnabledForrDEBUGselfrs rzclass_logger..Ns)<)< *r!cBjtjSr-)r.rINFOr0s rr2zclass_logger..Qs(;(; )r!)r getLoggerr*_should_log_debug_should_log_inforr"add)r)rs @r class_loggerr9LsI   8= >FCCCJ Jr!InstanceLoggercDeZdZUdZdZded<ded<ded<d d Zd d Zy) rNz Optional[str] logging_name_IdentifiedLoggerTyper _EchoFlagType_echocT|jjtjSr-)rr.rr/r1s rr6zIdentified._should_log_debuges{{'' 66r!cT|jjtjSr-)rr.rr4rBs rr7zIdentified._should_log_infohs{{'' 55r!)returnbool)r(r' __qualname__ __slots__r=__annotations__r6r7r<r!rrr\s'I"&L-& !! 76r!ceZdZUdZej ej ej ejdZde d<dZ ddZ ddZ ddZ dd ZeZdd Zdd Zdd Zdd ZddZddZy)r:aA logger adapter (wrapper) for :class:`.Identified` subclasses. This allows multiple instances (e.g. Engine or Pool instances) to share a logger, but have its verbosity controlled on a per-instance basis. The basic functionality is to return a logging level which is based on an instance's echo setting. Default implementation is: 'debug' -> logging.DEBUG True -> logging.INFO False -> Effective level of underlying logger ( logging.WARNING by default) None -> same as False )NFTrr?r@)echorc||_tj||_|j|tj kr-|jj st|jyyyr-)rJrr5r _echo_mapr4handlersr )r1rJnames r__init__zInstanceLogger.__init__sS ''-  >>$ 7<< / 8L8L  -9M /r!cN|jtj|g|i|y)z/Delegate a debug call to the underlying logger.N)logrr/r1msgargskwargss rrzInstanceLogger.debugs" 5d5f5r!cN|jtj|g|i|y)z/Delegate an info call to the underlying logger.N)rQrr4rRs rinfozInstanceLogger.infos" s4T4V4r!cN|jtj|g|i|y)z1Delegate a warning call to the underlying logger.N)rQrWARNINGrRs rwarningzInstanceLogger.warnings" #777r!cN|jtj|g|i|y)zB Delegate an error call to the underlying logger. NrQrERRORrRs rerrorzInstanceLogger.errors" 5d5f5r!cXd|d<|jtj|g|i|y)z4Delegate an exception call to the underlying logger.r exc_infoNr\rRs r exceptionzInstanceLogger.exceptions,z5d5f5r!cN|jtj|g|i|y)z2Delegate a critical call to the underlying logger.N)rQrCRITICALrRs rcriticalzInstanceLogger.criticals$ !!3888r!cf|jjj|k\ry|j|j}|t j k(r|jj}||k\rBtr|jddtz|d<|jj|||fi|yy)zDelegate 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. N stacklevelr ) rmanagerdisablerLrJrNOTSETgetEffectiveLevel STACKLEVELgetSTACKLEVEL_OFFSET_log)r1levelrSrTrUselected_levels rrQzInstanceLogger.logs ;;   & &% /  2 W^^ +![[::> !r!ct||y)N)r|)r})r1r{values r__set__zecho_property.__set__s 51r!N)r{z Literal[None]rType[Identified]rDr)r{rrrrDr?)r{zOptional[Identified]rrrDz#Union[echo_property, _EchoFlagType])r{rrr?rDru)r(r'rFrwrrrr<r!rrrsG%.> "+; ","5E" ,"2r!r)rzlogging.LoggerrDru)r)rrDrt)r) Type[_IT]rDrr-)r{rr|r?rDru))rw __future__rrrtypingrrrrrr r utilr r util.typingrrkrmrrEr?r5 rootloggerrorisetLevelWARNr setr"rHr*r9Loggerr>rr:r}rr<r!rrs& #  J#J e<(dD''"223 W  | ,  w~~% %*-&. gnn.>>? 6 6 uur59$1 <22r!