
    ہh                     "    d dl Z ddededefdZy)    Nvalue
max_lengthreturnc                     | yt        | t              st        |       } t        j                  dd|       } t        j                  dd|       j	                         } t        |       |kD  r| d| dz   } | S )zSanitize potentially attacker-controlled strings before logging.

    - Strip CR, LF, TAB and other ASCII control characters (0x00-0x1F, 0x7F)
    - Collapse whitespace runs to a single space
    - Truncate overly long inputs to max_length
    N z[\x00-\x1F\x7F] z\s+u   …)
isinstancestrresubstriplen)r   r   s      E:\workrun\ive\core\log_utils.pysanitize_for_logr      so     }eS!E
FF%sE2EFF63&,,.E
5zJkz"U*L    )i   )r   r
   intr    r   r   <module>r      s"    	C S C r   