
    ^h                        S r SSKJr  SSKrSSKrSSKJrJrJrJ	r	  SSK
r
SSKJr  SSKJr   " S S	\R                  5      r " S
 S\R"                  5      rSS jrg)zJSON formatter using the standard library's `json` for encoding.

Module contains the `JsonFormatter` and a custom `JsonEncoder` which supports a greater
variety of types.
    )annotationsN)AnyCallableOptionalUnion   )core)defaultsc                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )JsonEncoder   zkA custom encoder extending [json.JSONEncoder](https://docs.python.org/3/library/json.html#json.JSONEncoder)c                  > [         R                  " U5      (       a  U R                  U5      $ [         R                  " U5      (       a  [         R                  " U5      $ [         R
                  " U5      (       a  [         R                  " U5      $ [         R                  " U5      (       a  [         R                  " U5      $ [         R                  " U5      (       a  [         R                  " U5      $ [         R                  " U5      (       a  [         R                  " U5      $ [         R                  " U5      (       a  [         R                  " U5      $  [        TU ]A  U5      $ ! ["         a    [         R$                  " U5      s $ f = f)N)duse_datetime_anyformat_datetime_objuse_exception_defaultexception_defaultuse_traceback_defaulttraceback_defaultuse_enum_defaultenum_defaultuse_bytes_defaultbytes_defaultuse_dataclass_defaultdataclass_defaultuse_type_defaulttype_defaultsuperdefault	TypeErrorunknown_default)selfo	__class__s     O/home/james-whalen/.local/lib/python3.13/site-packages/pythonjsonlogger/json.pyr   JsonEncoder.default   s   a  ++A..""1%%&&q))""1%%&&q))a  >>!$$q!!??1%%""1%%&&q))a  >>!$$	(7?1%% 	($$Q''	(s   E$ $ FFc                .    [         R                  " U5      $ )zFormat datetime objects found in `self.default`

This allows subclasses to change the datetime format without understanding the
internals of the default method.
)r   datetime_any)r"   r#   s     r%   r   JsonEncoder.format_datetime_obj7   s     ~~a       )r#   r   returnr   )r#   z1datetime.time | datetime.date | datetime.datetimer,   str)	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classcell__r$   s   @r%   r   r      s    u(6! !r*   r   c                  t   ^  \ rS rSrSrSS\R                  SSS.           S	U 4S jjjrS
S jrSr	U =r
$ )JsonFormatter@   znJSON formatter using the standard library's [`json`](https://docs.python.org/3/library/json.html) for encodingNT)json_defaultjson_encoderjson_serializerjson_indentjson_ensure_asciic                  > [         TU ]  " U0 UD6  Xl        X l        X0l        X@l        XPl        U R                  (       d  U R                  (       d  [        U l        g)a3  
Args:
    args: see [BaseJsonFormatter][pythonjsonlogger.core.BaseJsonFormatter]
    json_default: a function for encoding non-standard objects
    json_encoder: custom JSON encoder
    json_serializer: a [`json.dumps`](https://docs.python.org/3/library/json.html#json.dumps)-compatible callable
        that will be used to serialize the log record.
    json_indent: indent parameter for the `json_serializer`
    json_ensure_ascii: `ensure_ascii` parameter for the `json_serializer`
    kwargs: see [BaseJsonFormatter][pythonjsonlogger.core.BaseJsonFormatter]
N)r   __init__r9   r:   r;   r<   r=   r   )	r"   r9   r:   r;   r<   r=   argskwargsr$   s	           r%   r?   JsonFormatter.__init__C   sQ    * 	$)&)((.&!2  ):): +Dr*   c                x    U R                  UU R                  U R                  U R                  U R                  S9$ )z&Returns a json string of the log data.)r   clsindentensure_ascii)r;   r9   r:   r<   r=   )r"   log_datas     r%   jsonify_log_record JsonFormatter.jsonify_log_recordc   sA    ##%%!!##// $ 
 	
r*   )r9   r:   r=   r<   r;   )r9   Optional[Callable]r:   rJ   r;   r   r<   zOptional[Union[int, str]]r=   boolr,   None)rG   zcore.LogDatar,   r-   )r.   r/   r0   r1   r2   jsondumpsr?   rH   r3   r4   r5   s   @r%   r7   r7   @   sl    x
 ,0+/$(JJ15"& ) )	
 " /   
 @
 
r*   r7   c                    U S:X  a+  [         R                  " S[        5        [        R                  $ [        S[         SU  35      e)NRESERVED_ATTRSz6RESERVED_ATTRS has been moved to pythonjsonlogger.corezmodule z has no attribute )warningswarnDeprecationWarningr	   rP   AttributeErrorr.   )names    r%   __getattr__rV   p   sD    D	
 """
78*,>tfE
FFr*   )rU   r-   )r2   
__future__r   datetimerM   typingr   r   r   r   rQ    r	   r
   r   JSONEncoderr   BaseJsonFormatterr7   rV   r+   r*   r%   <module>r]      sT    #   1 1   
$!$"" $!N+
D** +
`Gr*   