File: //opt/alt/python27/lib/python2.7/site-packages/fluent/handler.pyc
�
c�ec @ s� d d l Z d d l Z d d l Z y d d l Z Wn e k
rS d d l Z n Xy e Wn e k
r{ e e f Z n Xd d l
m Z d e j e
f d � � YZ d e j f d � � YZ d S( i����N( t sendert FluentRecordFormatterc B s� e Z d Z d d d e e d d � Z d � Z d � Z d � Z d � Z
d � Z d � Z d � Z
d
� Z e d � � Z RS(
s7 A structured formatter for Fluent.
Best used with server storing data in an ElasticSearch cluster for example.
:param fmt: a dict or a callable with format string as values to map to provided keys.
If callable, should accept a single argument `LogRecord` and return a dict,
and have a field `usesTime` that is callable and return a bool as would
`FluentRecordFormatter.usesTime`
:param datefmt: strftime()-compatible date/time format string.
:param style: '%', '{' or '$' (used only with Python 3.2 or above)
:param fill_missing_fmt_key: if True, do not raise a KeyError if the format
key is not found. Put None if not found.
:param format_json: if True, will attempt to parse message as json. If not,
will use message as-is. Defaults to True
:param exclude_attrs: switches this formatter into a mode where all attributes
except the ones specified by `exclude_attrs` are logged with the record as is.
If `None`, operates as before, otherwise `fmt` is ignored.
Can be an iterable.
t %c C s� t t | � j d | � t j d d !d k r� | d k r� i t j i d d 6d d 6d d
6f d 6t j i d d 6d
d 6d d
6f d 6| \ | _ } n$ d | _ i d d 6d d 6d d
6} | d k rt
| � | _ d | _ | j
| _ t t | � j | _ n{ d | _ | s:| | _ | j | _ | j | _ nH t | d � ra| | _ | j | _ n! | | _ | j | _ | j | _ | r�| j | _ n | j | _ t j � | _ | | _ d S( Ni i i R s
{hostname}t sys_hosts {name}t sys_names {module}t
sys_modulet {s ${hostname}s ${name}s ${module}t $s %(hostname)ss %(name)ss
%(module)st __call__( i i ( t superR t __init__t Nonet syst version_infot loggingt StrFormatStylet StringTemplateStylet _FluentRecordFormatter__stylet sett
_exc_attrst _fmt_dictt _format_by_exclusiont
_formattert usesTimet _format_by_dictt _format_by_dict_uses_timet hasattrt _format_msg_jsont _format_msgt _format_msg_defaultt sockett gethostnamet hostnamet fill_missing_fmt_key( t selft fmtt datefmtt styleR! t format_jsont
exclude_attrst basic_fmt_dict( ( s? /opt/alt/python27/lib/python2.7/site-packages/fluent/handler.pyR
) sL "
c C sE t t | � j | � | j | _ | j | � } | j | | � | S( N( R R t formatR R t _structuring( R"