• File: log.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/__pycache__/log.cpython-37.opt-1.pyc
  • Date Modified: 06/27/2022 11:12 PM
  • File size: 6.4 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

4]%@sdZddlZddlZedZejejkr6eejddZ	e
ZddZGdd	d	e
ZGd
dde
Zddd
ZGddde
ZdS)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`
and :class:`.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)loggingZ
StreamHandlersysstdoutZsetFormatterZ	FormatterZ
addHandler)loggerZhandlerrA/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/log.py_add_default_handler!srcsFt|jd|jfdd|_fdd|_|_t||S)N.cstjS)N)isEnabledForrDEBUG)self)rrr<lambda>.zclass_logger.<locals>.<lambda>cstjS)N)r
rINFO)r)rrrr
/r)	r	getLogger
__module____name___should_log_debug_should_log_infor_logged_classesadd)clsr)rrclass_logger,s
rc@s eZdZdZddZddZdS)
IdentifiedNcCs|jtjS)N)rr
rr)rrrrr8szIdentified._should_log_debugcCs|jtjS)N)rr
rr)rrrrr;szIdentified._should_log_info)rr__qualname__logging_namerrrrrrr5src@szeZdZdZejejejejdZddZ	ddZ
ddZd	d
ZeZ
dd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|jdS)N)echorrr	_echo_maprZhandlersr)rrnamerrr__init__ZszInstanceLogger.__init__cOs|jtj|f||dS)z/Delegate a debug call to the underlying logger.N)logrr)rmsgargskwargsrrrrfszInstanceLogger.debugcOs|jtj|f||dS)z/Delegate an info call to the underlying logger.N)r"rr)rr#r$r%rrrinfokszInstanceLogger.infocOs|jtj|f||dS)z1Delegate a warning call to the underlying logger.N)r"rZWARNING)rr#r$r%rrrwarningpszInstanceLogger.warningcOs|jtj|f||dS)zB
        Delegate an error call to the underlying logger.
        N)r"rERROR)rr#r$r%rrrerrorwszInstanceLogger.errorcOs"d|d<|jtj|f||dS)z4Delegate an exception call to the underlying logger.exc_infoN)r"rr()rr#r$r%rrr	exception}szInstanceLogger.exceptioncOs|jtj|f||dS)z2Delegate a critical call to the underlying logger.N)r"rZCRITICAL)rr#r$r%rrrcriticalszInstanceLogger.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)	rmanagerdisablerrrNOTSETgetEffectiveLevelZ_log)rlevelr#r$r%Zselected_levelrrrr"s

zInstanceLogger.logcCs|jjj|krdS||kS)z)Is this logger enabled for level 'level'?F)rr.r/r1)rr2rrrr
szInstanceLogger.isEnabledForcCs$|j|j}|tjkr |j}|S)z+What's the effective level for this logger?)rrrr0rr1)rr2rrrr1s

z InstanceLogger.getEffectiveLevelN)rrr__doc__rr0rrrr!rr&r'warnr)r,r-r"r
r1rrrrr?s 
rcCsb|jr d|jj|jj|jf}nd|jj|jjf}||_|dkrNt|}n
t||}||_dS)zEcreate a logger for an instance that implements :class:`.Identified`.z%s.%s.%sz%s.%s)FNN)	r	__class__rr_echorrrr)instanceechoflagr rrrrinstance_loggers
r9c@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|jSdS)N)r6)rr7ownerrrr__get__szecho_property.__get__cCst||ddS)N)r8)r9)rr7valuerrr__set__szecho_property.__set__N)rrrr3r<r>rrrrr:s	r:)N)r3rrrZ
rootloggerr2r0ZsetLevelZWARNrsetrrobjectrrr9r:rrrr<module>s
	
o