3 2g(@sNddlZddlZddlmZmZddlmZd ddZd dd Zdd d Z dS)N)dedentindent) getLoggerTcCs>|rtjtjdd}tdt||tjdtjddS)zFunction to print out an error message to stderr and exit. It can optionally print the stack trace as well. Args: error_msg : error message to print stack_trace : set to True to print stack trace Returns: None )filez Exiting with nonzero status.z FATAL ERROR: N) tracebackZ print_stacksysstderrprintrexit)Z error_msgZ stack_traceZ msg_footerr C/lfs/h1/ops/prod/packages/aqm.v7.0.11/ush/python_utils/print_msg.pyprint_err_msg_exit s rcCs|rtt|dSdS)aKFunction to print information message to stdout, when verbose is set to True. It does proper "dedentation" that is needed for readability of python code. Args: info_msg : info message to print verbose : set to False to silence printing Returns: True: if message is successfully printed TF)r r)info_msgverboser r rprint_info_msgs  rcCs>ttjjjj}|r:|r0|jtt|dn |j|dS)aaFunction to print information message using the logging module. This function should not be used if python logging has not been initialized. Args: info_msg : info message to print verbose : set to False to silence printing dedent_ : set to False to disable "dedenting" (print string as-is) Returns: None z N) rr _getframef_backf_codeco_nameinforr)rrZdedent_Zloggerr r rlog_info-s r)rT)T)TT) rr textwraprrZloggingrrrrr r r rs