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


Python log.Log方法代码示例

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


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

示例1: __init__

# 需要导入模块: import log [as 别名]
# 或者: from log import Log [as 别名]
def __init__(self, tool_name, tool_version):
        self.tool_name    = tool_name
        self.tool_version = tool_version

        self.terminateFlingOnException = False

        self.env      = argparse.Namespace()
        self.params   = argparse.Namespace()
        self.key_data = None
        self.vinfo    = None
        
        self.log = Log(self.tool_name, self.tool_version)
        self.log.open()
        
        self._init_parser() 
开发者ID:RiskSense-Ops,项目名称:CVE-2016-6366,代码行数:17,代码来源:sploit.py

示例2: __init__

# 需要导入模块: import log [as 别名]
# 或者: from log import Log [as 别名]
def __init__(self, config = {'host': '0.0.0.0', 'port': 44403}) :
        self._host = config['host']
        self._port = config['port']
        self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self._state = 'stopped'
        #self._logger = log.Log() 
开发者ID:fadushin,项目名称:esp8266,代码行数:8,代码来源:server.py

示例3: commonArgs

# 需要导入模块: import log [as 别名]
# 或者: from log import Log [as 别名]
def commonArgs(p):
    p.add_argument('-l', '--log-level',               dest='d', metavar='LEVEL', help='Log level', default='WARNING')
    p.add_argument(      '--syslog',                  dest='syslog', const='syslog', action='store_const', help='Use syslog', default=None)
    p.add_argument('-v', '--verbose',                 metavar='VERBOSITY', action='store_const', dest='v', const='v', help='Be more verbose')
    p.add_argument('-h', '--help',                    metavar='HELP', required=None, action='store_const', dest='h', const='h', help='Help')
    p.add_argument('-f', '--config',                  metavar='CONFIGFILE', required=None, is_config_file=True, default=config.Config.CONFIGFILE, help='Config file')    
    p.add_argument('-s', '--sdp',                     metavar='SDPFILE', required=None, default=config.Config.SDPFILE, help='SDP file')
    p.add_argument('-p', '--pid',                     dest='p', metavar='PIDFILE', required=None, default=config.Config.PIDFILE, help='PID file')
    p.add_argument('-A', '--authids',                 dest='A', metavar='FILE', help='Authids db file.', default="none")
    p.add_argument('-a', '--audit-log',               dest='a', metavar='FILE', help='Audit log file', default=config.CONFIG.PREFIX + '/var/log/audit.log')        
    p.add_argument(      '--audit-log-json',          dest='aj', action='store_const', const='aj', metavar='Bool', help='Audit log to JSON', default=None)
    p.add_argument('-lc' ,'--logging-conf',           dest='lc', metavar='FILE', help='Logging config file')
    p.add_argument(       '--service-conf-dir',       dest='serviceDir', metavar='DIR', required=None, default=None, help='Use this directory to save config files for service. Use only for config generation per one service!')
    p.add_argument(       '--haproxy-bin',            dest='haproxyBin', metavar='Binary', required=None, help='Haproxy binary', default=config.Config.HAPROXY_BIN)
    p.add_argument(       '--openvpn-bin',            dest='openvpnBin', metavar='Binary', required=None, help='OpenVPN binary', default=config.Config.OPENVPN_BIN)
    p.add_argument(       '--stunnel-bin',            dest='stunnelBin', metavar='Binary', required=None, help='Stunnel binary', default=config.Config.STUNNEL_BIN)    
    p.add_argument(       '--sdp-server-uri',         dest='sdpUri', metavar='URL', required=None, help='SDP server(s)', default='https://sdp.lethean.io')
    p.add_argument(       '--sdp-wallet-address',     dest='sdpWallet', metavar='ADDRESS', required=None, help='SDP server wallet address', default='iz4xKrEdzsF5dP7rWaxEUT4sdaDVFbXTnD3Y9vXK5EniBFujLVp6fiAMMLEpoRno3VUccxJPnHWyRctmsPiX5Xcd3B61aDeas')
    p.add_argument(       '--sdp-service-endpoint',   dest='serviceFqdn', metavar='FQDN', required=None, help='Service FQDN or IP')
    p.add_argument(       '--sdp-service-port',       dest='servicePort', metavar='NUMBER', required=None, help='Service port')
    p.add_argument(       '--sdp-service-proto',      dest='serviceProto', metavar='PROTOCOL', required=None, default=None, help='Service protocol')
    p.add_argument(       '--sdp-service-id',         dest='serviceId', metavar='NUMBER', required=None, help='Service ID')
    p.add_argument(       '--provider-id',            dest='providerid', metavar='PROVIDERID', required=None, default='<NOID>', help='ProviderID (public ed25519 key)')
    p.add_argument(       '--ca',                     dest='providerCa', metavar="ca.crt", required=None, default='<NOCA>', help='Set certificate authority file')
    p.add_argument(       '--wallet-address',         dest='walletAddr', metavar='ADDRESS', required=None, default='<NOADDR>', help='Provider wallet address')
    p.add_argument(       '--sdp-cache-dir',          dest='sdpCacheDir', metavar='DIR', required=None, default=config.CONFIG.PREFIX + '/var/', help='SDP cache dir')
    p.add_argument(       '--sdp-cache-expiry',       dest='sdpCacheExpiry', metavar='SECONDS', required=None, default=300, help='SDP cache expiry in seconds')
    p.add_argument(       '--compatibility',          dest='comp', metavar='Level', required=None, default="v3", choices=["v3.1", "v3"], help='Compatibility level for remote node. Use v3.1 or v3')
    p.add_argument(       '--vpnd-dns',               dest='vpndDns', metavar='IP', required=None, default=None, help='Use and offer local DNS server for VPN clients')
    p.add_argument(       '--vpnd-more-user-sessions',dest='duplicateCN', metavar='bool', action='store_const', const='duplicateCN', required=None, default=None, help='If true, user can connect multiple sessions with one paymentid.')
    p.add_argument(       '--vpnd-iprange',           dest='vpndIPRange', metavar='IP', required=None, default="10.11.0.0", help='IP Range for client IPs. Client will get /30 subnet from this range.')
    p.add_argument(       '--vpnd-ipmask',            dest='vpndIPMask', metavar='MASK', required=None, default="255.255.0.0", help='IP mask for client IPs')
    p.add_argument(       '--vpnd-ip6range',          dest='vpndIP6Range', metavar='IP6', required=None, default=None, help='IP6 Range for client IPs. Client will get /30 subnet from this range.')
    p.add_argument(       '--vpnd-reneg',             dest='vpndReneg', metavar='S', required=None, default=600, help='Client has to renegotiate after this number of seconds to check if paymentid is still active')
    p.add_argument(       '--vpnd-tun',               dest='vpndTun', metavar='IF', required=None, default="tun0", help='Use specific tun device for server')
    p.add_argument(       '--vpnd-mgmt-port',         dest='vpndMgmtPort', metavar='PORT', required=None, default="11192", help='Use specific port for local mgmt')
    p.add_argument(       '--vpnc-standalone',        dest='vpncStandalone', action='store_const', const='vpncStandalone', metavar='Bool', required=None, help='Create standalone openvn config that can be run outside of dispatcher.')
    p.add_argument(       '--proxyc-standalone',      dest='proxycStandalone',  action='store_const', const='proxycStandalone', metavar='Bool', required=None, help='Create standalone haproxy config that can be run outside of dispatcher.')
    p.add_argument(       '--no-run',                 dest='noRun', action='store_const', const='vpncStandalone', metavar='Bool', required=None, help='Do not run openvpn or haproxy, just prepare configs') 
开发者ID:LetheanMovement,项目名称:lethean-vpn,代码行数:41,代码来源:util.py

示例4: parseCommonArgs

# 需要导入模块: import log [as 别名]
# 或者: from log import Log [as 别名]
def parseCommonArgs(parser, cfg, name):
    if (cfg.lc):
        logging.config.fileConfig(cfg.lc)
        log.L = log.Log(level=cfg.d, name=name)
        log.A = log.Audit(level=logging.WARNING)
    elif (cfg.syslog):
        h = logging.handlers.SysLogHandler(address="/dev/log")
        log.L = log.Log(level=cfg.d, name=name, handler=h)
        log.A = log.Audit(handler=h)
    else:
        ah = logging.FileHandler(cfg.a)
        log.L = log.Log(level=cfg.d, name=name)
        log.A = log.Audit(handler=ah)
    config.Config.VERBOSE = cfg.v
    config.Config.CONFIGFILE = cfg.config
    config.Config.SDPFILE = cfg.sdp
    config.Config.d = cfg.d
    config.Config.a = cfg.a
    config.Config.SDPURI = cfg.sdpUri
    config.CONFIG.PIDFILE = cfg.p
    if (config.Config.AUTHIDSFILE == "none"):
        config.Config.T_SAVE = 0
        config.Config.AUTHIDSFILE = ''
    if (cfg.comp=="v3"):
        cfg.mgmtHeader="X-ITNS-MgmtID"
        cfg.authidHeader="X-ITNS-PaymentID"
    elif (cfg.comp=="v3.1"):
        cfg.mgmtHeader="X-LTHN-MgmtID"
        cfg.authidHeader="X-LTHN-PaymentID"
    else:
        log.L.error("Bad compatibility level.")
        sys.exit(2)
    if cfg.sdpUri.endswith('/'):
        cfg.sdpUri = cfg.sdpUri[:-1]
    if not cfg.sdpUri.endswith('/v1'):
        cfg.sdpUri = cfg.sdpUri + '/v1'
    cfg.sdpUri = {'sdp': cfg.sdpUri}
    if cfg.noRun:
        cfg.vpncStandalone = True
        cfg.proxycStandalone = True
    
    # Initialise services
    services.SERVICES = services.Services()

    if (cfg.h):
        helpmsg(parser)
        sys.exit() 
开发者ID:LetheanMovement,项目名称:lethean-vpn,代码行数:49,代码来源:util.py

示例5: main

# 需要导入模块: import log [as 别名]
# 或者: from log import Log [as 别名]
def main():
    parser = argparse.ArgumentParser()
    source_group = parser.add_mutually_exclusive_group(required=True)
    source_group.add_argument('-i', '--interface', help="the interface to bind to")
    source_group.add_argument('-F', '--file', help="pcap file containing captured traffic to analyze")
    parser.add_argument('-p', '--port', type=int, help="the port to grab packets from.  Default: 6379", default=6379)
    parser.add_argument('--out', default='.', help="the location to generate the full or event logs, defaults to the \
                        directory the application is executed from")
    parser.add_argument('-l', choices=['debug', 'event', 'full'], default='full', help="the type of log(s) you want to \
                        create. Default: full")
    parser.add_argument('-el', '--event-log', default="event", help="the name of the event outout file. \
                        Default: event_sniff")
    parser.add_argument('-fl', '--full-log', default="full", help="the name of the full sniff output file. \
                        Default: full_sniff")
    parser.add_argument('-f', '--filter', default="", help="comma separated list of events to log(ex: setex,delete)"
                        )
    parser.add_argument('--append', default="_sniff", help="the suffix to append to command logs")
    parser.add_argument('--extra', help="log non-redis traffic")
    args = parser.parse_args()
    fmt_full = '%.6f %-21s %8d %8d %s\n'
    fmt = '%s\n'
    event_filters = args.filter.split(',') if args.filter else []

    logger = Log(args.l, args.out, {'event': args.event_log, 'full': args.full_log}, event_filters, args.append)

    log_level = logging.INFO
    if args.l == 'debug':
        log_level = logging.DEBUG

    logging.basicConfig(filename=os.path.join(args.out, 'sniffer.log'), level=log_level)

    source = args.interface if args.interface else args.file
    sniffer = Sniffer(source, args.port)

    for session in sniffer.sniff():
        ptime, client, req_size, resp_size, command = session
        comm_parts = command.split()
        if comm_parts[0].lower() in event_filters:
            logger.write_command(comm_parts[0].lower(), command)
        if logger.event_log:
            logger.write_event(fmt % command)
        if logger.full_log:
            logger.write_log(fmt_full % (ptime, client, req_size, resp_size, command)) 
开发者ID:jplesperance,项目名称:redis-sniffer,代码行数:45,代码来源:main.py


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