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


Python options.add_parse_callback方法代碼示例

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


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

示例1: define_logging_options

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import add_parse_callback [as 別名]
def define_logging_options(options=None):
    if options is None:
        # late import to prevent cycle
        from tornado.options import options
    options.define("logging", default="info",
                   help=("Set the Python log level. If 'none', tornado won't touch the "
                         "logging configuration."),
                   metavar="debug|info|warning|error|none")
    options.define("log_to_stderr", type=bool, default=None,
                   help=("Send log output to stderr (colorized if possible). "
                         "By default use stderr if --log_file_prefix is not set and "
                         "no other logging is configured."))
    options.define("log_file_prefix", type=str, default=None, metavar="PATH",
                   help=("Path prefix for log files. "
                         "Note that if you are running multiple tornado processes, "
                         "log_file_prefix must be different for each of them (e.g. "
                         "include the port number)"))
    options.define("log_file_max_size", type=int, default=100 * 1000 * 1000,
                   help="max size of log files before rollover")
    options.define("log_file_num_backups", type=int, default=10,
                   help="number of log files to keep")

    options.add_parse_callback(enable_pretty_logging) 
開發者ID:viewfinderco,項目名稱:viewfinder,代碼行數:25,代碼來源:log.py

示例2: define_logging_options

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import add_parse_callback [as 別名]
def define_logging_options(options=None):
    """Add logging-related flags to ``options``.

    These options are present automatically on the default options instance;
    this method is only necessary if you have created your own `.OptionParser`.

    .. versionadded:: 4.2
        This function existed in prior versions but was broken and undocumented until 4.2.
    """
    if options is None:
        # late import to prevent cycle
        from tornado.options import options
    options.define("logging", default="info",
                   help=("Set the Python log level. If 'none', tornado won't touch the "
                         "logging configuration."),
                   metavar="debug|info|warning|error|none")
    options.define("log_to_stderr", type=bool, default=None,
                   help=("Send log output to stderr (colorized if possible). "
                         "By default use stderr if --log_file_prefix is not set and "
                         "no other logging is configured."))
    options.define("log_file_prefix", type=str, default=None, metavar="PATH",
                   help=("Path prefix for log files. "
                         "Note that if you are running multiple tornado processes, "
                         "log_file_prefix must be different for each of them (e.g. "
                         "include the port number)"))
    options.define("log_file_max_size", type=int, default=100 * 1000 * 1000,
                   help="max size of log files before rollover")
    options.define("log_file_num_backups", type=int, default=10,
                   help="number of log files to keep")

    options.define("log_rotate_when", type=str, default='midnight',
                   help=("specify the type of TimedRotatingFileHandler interval "
                         "other options:('S', 'M', 'H', 'D', 'W0'-'W6')"))
    options.define("log_rotate_interval", type=int, default=1,
                   help="The interval value of timed rotating")

    options.define("log_rotate_mode", type=str, default='size',
                   help="The mode of rotating files(time or size)")

    options.add_parse_callback(lambda: enable_pretty_logging(options)) 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:42,代碼來源:log.py

示例3: add_parse_callback

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import add_parse_callback [as 別名]
def add_parse_callback(self, callback):
        """Adds a parse callback, to be invoked when option parsing is done."""
        self._parse_callbacks.append(stack_context.wrap(callback)) 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:5,代碼來源:options.py

示例4: add_parse_callback

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import add_parse_callback [as 別名]
def add_parse_callback(self, callback: Callable[[], None]) -> None:
        """Adds a parse callback, to be invoked when option parsing is done."""
        self._parse_callbacks.append(callback) 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:5,代碼來源:options.py


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