var/opt/nydus/ops/primordial/log/__pycache__/extra.cpython-38.pyc000064400000006210147206007550021014 0ustar00U afw @sddlZddlZddlmZmZmZddlmZe e Z Gdddej dZ Gddde ZGd d d e ZGd d d e ZdS) N)AnyDictOptional) EnvelopeRolec@speZdZdZdZeddddZeeddddZeddd d Z ee dd d d Z de ee dddZ dS)LogExtrazmAbstract Base Class that provides a set of methods for extraction, setting and retrieval of 'extra' log data.extraNkwargsreturncKsi|_|jf|dSN)rsetselfr rE/opt/nydus/tmp/pip-target-53d1vnqk/lib/python/primordial/log/extra.py__init__szLogExtra.__init__cKsftj}tj|kr|tj}|tjkr.tf|S|tjkrBtf|S|tjkrVtf|St d|dS)z1Factory method to create a new LogExtra instance.z Invalid role N) rZ DEFAULT_ROLE ROLE_FIELDROLE_DEVELOPMENT DevLogExtraROLE_BUSINESS_ANALYTICS BALogExtraROLE_PERFORMANCE PerfLogExtra ValueError)r rolerrr getLogExtras        zLogExtra.getLogExtracKs,|D]\}}|tjk r|||qdS)z"Set fields on a LogExtra instance.N)itemsrrsetField)rr kvrrrr %s z LogExtra.set)fieldvaluer cCs||j|<dS)zSet an individual field's value. :param field: The field to be set :param value: The value of the field Nr)rr r!rrrr+szLogExtra.setField)r r cCs*|dkrd|jiS||jkr&|j|SdS)Nrr")rr rrrget3s    z LogExtra.get)N)__name__ __module__ __qualname____doc__Z EXTRA_FIELDstrr staticmethodrr rrrr#rrrrr sr) metaclasscs(eZdZdZeddfdd ZZS)rzLog extra data for development.Nrc s tjf|tj|jtj<dSr )superrrrrrr  __class__rrr?szDevLogExtra.__init__r$r%r&r'r(r __classcell__rrr,rr=srcs(eZdZdZeddfdd ZZS)rz&Log extra data for business analytics.Nrc s tjf|tj|jtj<dSr )r+rrrrrr r,rrrFszBALogExtra.__init__r.rrr,rrDsrcs(eZdZdZeddfdd ZZS)rz$Log extra data for performance data.Nrc s tjf|tj|jtj<dSr )r+rrrrrr r,rrrMszPerfLogExtra.__init__r.rrr,rrKsr)abclogging.configloggingtypingrrrZprimordial.log.envelopedatar getLoggerr$LOGABCMetarrrrrrrrs  1