U aS@sdZddlZddlZedZejejkr6eejddZ e Z ddZ dd Z Gd d d eZGd d d eZdddZGdddeZdS)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. NZ sqlalchemycCs*ttj}|td||dS)Nz.%(asctime)s %(levelname)s %(name)s %(message)s)logging StreamHandlersysstdout setFormatter Formatter addHandler)loggerhandlerr OC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\log.py_add_default_handler!s  r cCst|ddp|jd|jS)NZ_sqla_logger_namespace.)getattr __module____name__clsr r r _qual_logger_name_for_cls,s rcs>tt|fdd|_fdd|_|_t||S)Ncs tjSN) isEnabledForrDEBUGselfr r r 5zclass_logger..cs tjSr)rrINFOrrr r r6r)r getLoggerr_should_log_debug_should_log_infor _logged_classesaddrr rr class_logger3s  r#c@s eZdZdZddZddZdS) IdentifiedNcCs|jtjSr)r rrrrr r r r?szIdentified._should_log_debugcCs|jtjSr)r rrrrr r r r BszIdentified._should_log_info)rr __qualname__ logging_namerr r r r r r$<sr$c@szeZdZdZejejejejdZddZ ddZ ddZ d d Z e Z d d Zd dZddZddZddZddZdS)InstanceLoggeraA 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 )NFTdebugcCs8||_t||_|j|tjkr4|jjs4t|jdSr)echorrr _echo_maprhandlersr )rr)namer r r __init__as zInstanceLogger.__init__cOs|jtj|f||dS)z/Delegate a debug call to the underlying logger.N)logrrrmsgargskwargsr r r r(mszInstanceLogger.debugcOs|jtj|f||dS)z/Delegate an info call to the underlying logger.N)r.rrr/r r r inforszInstanceLogger.infocOs|jtj|f||dS)z1Delegate a warning call to the underlying logger.N)r.rWARNINGr/r r r warningwszInstanceLogger.warningcOs|jtj|f||dS)zB Delegate an error call to the underlying logger. Nr.rERRORr/r r r error~szInstanceLogger.errorcOs"d|d<|jtj|f||dS)z4Delegate an exception call to the underlying logger.exc_infoNr6r/r r r exceptionszInstanceLogger.exceptioncOs|jtj|f||dS)z2Delegate a critical call to the underlying logger.N)r.rCRITICALr/r r r criticalszInstanceLogger.criticalcOsR|jjj|krdS|j|j}|tjkr2|j}||krN|jj|||f|dS)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) r managerdisabler*r)rNOTSETgetEffectiveLevel_log)rlevelr0r1r2Zselected_levelr r r r.s    zInstanceLogger.logcCs|jjj|krdS||kS)z)Is this logger enabled for level 'level'?F)r r>r?rArrCr r r rszInstanceLogger.isEnabledForcCs$|j|j}|tjkr |j}|S)z+What's the effective level for this logger?)r*r)rr@r rArDr r r rAs   z InstanceLogger.getEffectiveLevelN)rrr%__doc__rr@rrr*r-r(r3r5warnr8r;r=r.rrAr r r r r'Fs" r'cCsT|jrdt|j|jf}n t|j}||_|dkr@t|}n t||}||_dS)zEcreate a logger for an instance that implements :class:`.Identified`.z%s.%s)FNN)r&r __class___echorrr'r )instanceechoflagr,r r r r instance_loggers   rKc@s eZdZdZddZddZdS) echo_propertya} When ``True``, enable log output for this element. This has the effect of setting the Python logging level for the namespace of this element's class and object reference. A value of boolean ``True`` indicates that the loglevel ``logging.INFO`` will be set for the logger, whereas the string value ``debug`` will set the loglevel to ``logging.DEBUG``. cCs|dkr |S|jSdSr)rH)rrIownerr r r __get__szecho_property.__get__cCst||ddS)N)rJ)rK)rrIvaluer r r __set__szecho_property.__set__N)rrr%rErNrPr r r r rLs rL)N)rErrrZ rootloggerrCr@setLevelWARNr setr!rr#objectr$r'rKrLr r r r  s      o