当前位置: 首页>>代码示例>>Python>>正文


Python Logging.enableConsoleLogging方法代码示例

本文整理汇总了Python中seiscomp3.Logging.enableConsoleLogging方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.enableConsoleLogging方法的具体用法?Python Logging.enableConsoleLogging怎么用?Python Logging.enableConsoleLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在seiscomp3.Logging的用法示例。


在下文中一共展示了Logging.enableConsoleLogging方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import enableConsoleLogging [as 别名]
def main():
    from seiscomp3 import Logging
    Logging.enableConsoleLogging(Logging.getGlobalChannel("debug"))
    Logging.enableConsoleLogging(Logging.getGlobalChannel("info"))
    Logging.enableConsoleLogging(Logging.getGlobalChannel("warning"))
    Logging.enableConsoleLogging(Logging.getGlobalChannel("error"))
    
    parser = OptionParser(usage="usage: %prog -n <nrt_directory> -a <cur_arch_directory> -i <iso_directory>")
    parser.add_option("-n", "--nrtdir", type="string", dest="nrtdir", help="nrt directory")   
    parser.add_option("-a", "--archdir", type="string", dest="archdir", help="current archive directory")
    parser.add_option("-i", "--isodir", type="string", dest="isodir", help="iso archive directory")
    (options, args) = parser.parse_args()
    
    if options.nrtdir is None:
        parser.error("Error: nrt directory not specified!")
    if options.archdir is None:
        parser.error("Error: sds archive directory not specified!")
    if options.isodir is None:
        parser.error("Error: iso archive directory not specified!")
                
    sdsobj = SDS(options.nrtdir,options.archdir,options.isodir)
    reqlist = [(datetime.datetime(2005,12,20,16,50,0),datetime.datetime(2006,1,30,2,8,0),"WM","EMAL","BHZ","")]
    count = 0
    for req in reqlist:
        count += 1
        print count,". request"
        data = sdsobj.getwin(*req)
        if data is not None:
            print "data_%d" % count
            fh = file("data_%d" % count,"w")
            fh.write(data)
            fh.close()
        else:
            print "No data available"
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:36,代码来源:sds.py

示例2: process_options

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import enableConsoleLogging [as 别名]
def process_options():
    parser = OptionParser(usage="usage: %prog [options]",
      version="%prog v" + VERSION)

    parser.set_defaults(address = "webdc.eu:18001",
                        proxyport = 18001,
                        organization = "proxy",
                        dcid = "GFZ",
                        max_sessions = 500,
                        max_queued = 500,
                        max_queued_per_user = 10,
                        max_executing = 10,
                        max_lines = 5000,
                        max_age = 860000,
                        socket_timeout = 300,
                        request_timeout = 300,
                        download_retries = 5,
                        proxychain = False,
                        local = False)

    parser.add_option("-a", "--address", type="string", dest="address",
      help="address of primary ArcLink node (default %default)")

    parser.add_option("-P", "--proxyport", type="int", dest="proxyport",
      help="proxy port (default %default)")

    parser.add_option("-O", "--organization", type="string", dest="organization",
      help="organization name (default %default)")

    parser.add_option("-d", "--dcid", type="string", dest="dcid",
      help="datacenter ID (default %default)")

    parser.add_option("-S", "--max-sessions", type="int", dest="max_sessions",
      help="maximum number of sessions (default %default)")

    parser.add_option("-Q", "--max-queued", type="int", dest="max_queued",
      help="maximum number of queued requests (default %default)")

    parser.add_option("-U", "--max-queued-per-user", type="int", dest="max_queued_per_user",
      help="maximum number of queued requests (default %default)")

    parser.add_option("-X", "--max-executing", type="int", dest="max_executing",
      help="maximum number of requests executed in parallel (default %default)")

    parser.add_option("-L", "--max-lines", type="int", dest="max_lines",
      help="maximum number of lines in request (default %default)")

    parser.add_option("-T", "--max-age", type="int", dest="max_age",
      help="maximum age of request (default %default)")

    parser.add_option("-t", "--socket-timeout", type="int", dest="socket_timeout",
      help="socket timeout in seconds (default %default)")

    #parser.add_option("-r, "--request-timeout", type="int", dest="request_timeout",
    #  help="request timeout in seconds (default %default)")

    parser.add_option("-R", "--download-retries", type="int", dest="download_retries",
      help="download retries (default %default)")

    parser.add_option("-N", "--nrtdir", type="string", dest="nrtdir",
      help="NRT SDS directory (default %default)")

    parser.add_option("-A", "--arcdir", type="string", dest="arcdir",
      help="SDS archive directory (default %default)")

    parser.add_option("-I", "--isodir", type="string", dest="isodir",
      help="ISO archive directory (default %default)")

    parser.add_option("-p", "--disable-routing", action="store_true", dest="proxychain",
      help="disable routing")

    parser.add_option("-l", "--local-only", action="store_true", dest="local",
      help="use local SDS only")

    parser.add_option("-x", "--state-file", type="string", dest="state_file",
      help="save/restore request information to this file")

    parser.add_option("-v", action="callback", callback=add_verbosity,
      help="increase verbosity level")
    
    parser.add_option("-q", action="callback", callback=add_quietness,
      help="decrease verbosity level")
    
    global g_options
    (g_options, args) = parser.parse_args()

    if args:
        parser.error("incorrect number of arguments")

    if g_options.nrtdir is None:
        g_options.nrtdir = os.getenv("SEISCOMP_ROOT", "") + "/var/lib/archive"

    if g_options.arcdir is None:
        g_options.arcdir = "/dummy"

    if g_options.isodir is None:
        g_options.isodir = "/dummy"

    if g_verbosity > 1:
        Logging.enableConsoleLogging(Logging.getGlobalChannel("debug"))
#.........这里部分代码省略.........
开发者ID:Fran89,项目名称:seiscomp3,代码行数:103,代码来源:arclinkproxy.py


注:本文中的seiscomp3.Logging.enableConsoleLogging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。