當前位置: 首頁>>代碼示例>>Python>>正文


Python tornado.general方法代碼示例

本文整理匯總了Python中tornado.general方法的典型用法代碼示例。如果您正苦於以下問題:Python tornado.general方法的具體用法?Python tornado.general怎麽用?Python tornado.general使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado的用法示例。


在下文中一共展示了tornado.general方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: log_exception

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import general [as 別名]
def log_exception(self, typ, value, tb):
        """複寫來自定義未捕獲異常的日誌.

        默認情況下 `HTTPError` 的日誌實例作為警告(warning)沒有堆棧追蹤(在
        ``tornado.general`` logger), 其他作為錯誤(error)的異常帶有堆棧
        追蹤(在 ``tornado.application`` logger).

        .. versionadded:: 3.1
        """
        if isinstance(value, HTTPError):
            if value.log_message:
                format = "%d %s: " + value.log_message
                args = ([value.status_code, self._request_summary()] +
                        list(value.args))
                gen_log.warning(format, *args)
        else:
            app_log.error("Uncaught exception %s\n%r", self._request_summary(),
                          self.request, exc_info=(typ, value, tb)) 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:20,代碼來源:web.py

示例2: log_exception

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import general [as 別名]
def log_exception(self, typ, value, tb):
        """Override to customize logging of uncaught exceptions.

        By default logs instances of `HTTPError` as warnings without
        stack traces (on the ``tornado.general`` logger), and all
        other exceptions as errors with stack traces (on the
        ``tornado.application`` logger).

        .. versionadded:: 3.1
        """
        if isinstance(value, HTTPError):
            if value.log_message:
                format = "%d %s: " + value.log_message
                args = ([value.status_code, self._request_summary()] +
                        list(value.args))
                gen_log.warning(format, *args)
        else:
            app_log.error("Uncaught exception %s\n%r", self._request_summary(),
                          self.request, exc_info=(typ, value, tb)) 
開發者ID:viewfinderco,項目名稱:viewfinder,代碼行數:21,代碼來源:web.py

示例3: log_exception

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import general [as 別名]
def log_exception(
        self,
        typ: "Optional[Type[BaseException]]",
        value: Optional[BaseException],
        tb: Optional[TracebackType],
    ) -> None:
        """Override to customize logging of uncaught exceptions.

        By default logs instances of `HTTPError` as warnings without
        stack traces (on the ``tornado.general`` logger), and all
        other exceptions as errors with stack traces (on the
        ``tornado.application`` logger).

        .. versionadded:: 3.1
        """
        if isinstance(value, HTTPError):
            if value.log_message:
                format = "%d %s: " + value.log_message
                args = [value.status_code, self._request_summary()] + list(value.args)
                gen_log.warning(format, *args)
        else:
            app_log.error(  # type: ignore
                "Uncaught exception %s\n%r",
                self._request_summary(),
                self.request,
                exc_info=(typ, value, tb),
            ) 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:29,代碼來源:web.py


注:本文中的tornado.general方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。