redirector.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:vault-redirector-twisted 作者: manheim 项目源码 文件源码
def handle_logging_signal(self, signum, frame):
        """
        Handle a signal sent to this process (SIGUSR1 or SIGUSR2) to enable or
        disable logging.

        :param signum: signal number sent to process
        :type signum: int
        :param frame: current stack frame when signal was caught
        """
        if signum == signal.SIGUSR1:
            logger.warning('Logging enabled via signal; send SIGUSR2 to PID '
                           '%d to disable logging', getpid())
            self.log_enabled = True
        elif signum == signal.SIGUSR2:
            logger.warning('Logging disabled via signal; send SIGUSR1 to PID '
                           '%d to enable logging', getpid())
            self.log_enabled = False
        # else don't know how we got here, but ignore it
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号