本文整理汇总了Python中twisted.python.log.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _sighup_handler
def _sighup_handler(self, signum, frame):
self.ufc.configure()
# Si hemos cambiado la configuración de base de datos debemos abrir
# de nuevo todas las conexiones.
log.info("Restarting threadpool...")
reactor.getThreadPool().stop()
reactor.getThreadPool().start()
开发者ID:tic-ull,项目名称:ufc,代码行数:7,代码来源:server.py
示例2: dispatch
def dispatch(self, msg):
match = self.regex.search(msg)
if not match:
log.debug('Failed to match snort rule-sid in msg: {!r}'.format(msg))
return msg
sid = match.group('sid')
if self.gid_ignore:
try: gid = match.group('gid')
except IndexError: pass
else:
if gid in self.gid_ignore: return msg
ts = time()
if self.sid_db_ts < ts - self.conf.sid_db_mtime_check_interval:
if not os.path.exists(self.conf.paths.sid_db)\
or max(0, *( os.stat(p).st_mtime
for p in [self.conf.paths.sid_src, self.conf.paths.refs]
if os.path.exists(p) )) > os.stat(self.conf.paths.sid_db).st_mtime:
self.update_sid_db()
self.sid_db = anydbm.open(self.conf.paths.sid_db)
try: ref = force_unicode(self.sid_db[force_bytes(sid)])
except KeyError:
log.info('Failed to find refs for sid: {!r} (msg: {!r})'.format(sid, msg))
else: msg += u'\n refs: {}'.format(ref)
return msg
开发者ID:mk-fg,项目名称:bordercamp-irc-bot,代码行数:27,代码来源:pipe_snort_references.py
示例3: handle_data
def handle_data(self, pt, timestamp, sample, marker):
if self.Done:
if self._cbDone:
self._cbDone()
return
# We need to keep track of whether we were in silence mode or not -
# when we go from silent->talking, set the marker bit. Other end
# can use this as an excuse to adjust playout buffer.
if not self.sending:
if not hasattr(self, 'warnedaboutthis'):
log.info(("%s.handle_media_sample() should only be called" +
" only when it is in sending mode.") % (self,))
if VERBOSE:
print "WARNING: warnedaboutthis"
self.warnedaboutthis = True
return
incTS = True
#Marker is on first packet after a silent
if not self._silent:
if marker:
marker = 0
self._silent = True
incTS = False
else:
marker = 1
self._silent = False
if incTS:
#Taking care about ts
self.ts += int(timestamp)
# Wrapping
if self.ts >= TWO_TO_THE_32ND:
self.ts = self.ts - TWO_TO_THE_32ND
self._send_packet(pt, sample, marker=marker)
开发者ID:ViktorNova,项目名称:rtpmidi,代码行数:35,代码来源:protocol.py
示例4: prompt_user_for_chaincom_details
def prompt_user_for_chaincom_details():
"""
"""
config_file = get_config_file()
parser = SafeConfigParser()
parser.read(config_file)
if not parser.has_section('chain_com'):
message = '-' * 15 + '\n'
message += 'NOTE: Blockstore currently requires API access to chain.com\n'
message += 'for getting unspent outputs. We will add support for using\n'
message += 'bitcoind and/or other API providers in the next release.\n'
message += '-' * 15
log.info(message)
api_key_id = raw_input("Enter chain.com API Key ID: ")
api_key_secret = raw_input("Enter chain.com API Key Secret: ")
if api_key_id != '' and api_key_secret != '':
parser.add_section('chain_com')
parser.set('chain_com', 'api_key_id', api_key_id)
parser.set('chain_com', 'api_key_secret', api_key_secret)
fout = open(config_file, 'w')
parser.write(fout)
# update in config as well (which was already initialized)
config.CHAIN_COM_API_ID = api_key_id
config.CHAIN_COM_API_SECRET = api_key_secret
开发者ID:frrp,项目名称:blockstore,代码行数:31,代码来源:blockstored.py
示例5: init_bitcoind
def init_bitcoind():
"""
"""
config_file = get_config_file()
parser = SafeConfigParser()
parser.read(config_file)
if parser.has_section('bitcoind'):
try:
return create_bitcoind_connection()
except:
return prompt_user_for_bitcoind_details()
else:
pass
else:
user_input = raw_input(
"Do you have your own bitcoind server? (yes/no): ")
if user_input.lower() == "yes" or user_input.lower() == "y":
return prompt_user_for_bitcoind_details()
else:
log.info(
"Using default bitcoind server at %s", config.BITCOIND_SERVER)
return create_bitcoind_connection()
开发者ID:frrp,项目名称:blockstore,代码行数:25,代码来源:blockstored.py
示例6: onOpen
def onOpen(self):
log.info("WebSocket connection open.")
self.users = self.factory.users
self.factory.maxuid+=1
self.uid = self.factory.maxuid
self.users[self.uid]=self
self.sendMessage(json.dumps({"setuid":self.uid}))
开发者ID:gvtech,项目名称:python_twisted_examples,代码行数:8,代码来源:wsserver.py
示例7: request_exit_status
def request_exit_status(self, data):
# exit status is a 32-bit unsigned int in network byte format
status = struct.unpack_from(">L", data, 0)[0]
log.info("Received exit status request: %d", status)
self.exit_status = status
self.exit_defer.callback(self)
self.running = False
return True
开发者ID:Roguelazer,项目名称:Tron,代码行数:9,代码来源:ssh.py
示例8: vncdo
def vncdo():
usage = '%prog [options] (CMD CMDARGS|-|filename)'
description = 'Command line control of a VNC server'
op = VNCDoToolOptionParser(usage=usage, description=description)
add_standard_options(op)
op.add_option('--delay', action='store', metavar='MILLISECONDS',
default=os.environ.get('VNCDOTOOL_DELAY', 0), type='int',
help='delay MILLISECONDS between actions [%defaultms]')
op.add_option('--force-caps', action='store_true',
help='for non-compliant servers, send shift-LETTER, ensures capitalization works')
op.add_option('--localcursor', action='store_true',
help='mouse pointer drawn client-side, useful when server does not include cursor')
op.add_option('--nocursor', action='store_true',
help='no mouse pointer in screen captures')
op.add_option('-t', '--timeout', action='store', type='int', metavar='TIMEOUT',
help='abort if unable to complete all actions within TIMEOUT seconds')
op.add_option('-w', '--warp', action='store', type='float',
metavar='FACTOR', default=1.0,
help='pause time is accelerated by FACTOR [x%default]')
options, args = op.parse_args()
if not len(args):
op.error('no command provided')
setup_logging(options)
options.host, options.port = parse_host(options.server)
log.info('connecting to %s:%s', options.host, options.port)
factory = build_tool(options, args)
factory.password = options.password
if options.localcursor:
factory.pseudocusor = True
if options.nocursor:
factory.nocursor = True
if options.force_caps:
factory.force_caps = True
if options.timeout:
message = 'TIMEOUT Exceeded (%ss)' % options.timeout
failure = Failure(TimeoutError(message))
reactor.callLater(options.timeout, error, failure)
reactor.run()
sys.exit(reactor.exit_status)
开发者ID:csssuf,项目名称:vncdotool,代码行数:56,代码来源:command.py
示例9: receiveUnimplemented
def receiveUnimplemented( self, seqnum ):
"""
Called when an unimplemented packet message was received from the device.
@param seqnum: SSH message code
@type seqnum: integer
"""
message= "Got 'unimplemented' SSH message, seqnum= %d" % seqnum
log.info( message )
transport.SSHClientTransport.receiveUnimplemented(self, seqnum)
开发者ID:sheva-serg,项目名称:executor,代码行数:10,代码来源:zenosshclient.py
示例10: run_blockstored
def run_blockstored():
""" run blockstored
"""
global bitcoin_opts
parser = argparse.ArgumentParser(description="Blockstore Core Daemon version {}".format(config.VERSION))
parser.add_argument("--bitcoind-server", help="the hostname or IP address of the bitcoind RPC server")
parser.add_argument("--bitcoind-port", type=int, help="the bitcoind RPC port to connect to")
parser.add_argument("--bitcoind-user", help="the username for bitcoind RPC server")
parser.add_argument("--bitcoind-passwd", help="the password for bitcoind RPC server")
parser.add_argument("--bitcoind-use-https", action="store_true", help="use HTTPS to connect to bitcoind")
subparsers = parser.add_subparsers(dest="action", help="the action to be taken")
parser_server = subparsers.add_parser("start", help="start the blockstored server")
parser_server.add_argument("--foreground", action="store_true", help="start the blockstored server in foreground")
parser_server = subparsers.add_parser("stop", help="stop the blockstored server")
# Print default help message, if no argument is given
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
# propagate options
for (argname, config_name) in zip(
["bitcoind_server", "bitcoind_port", "bitcoind_user", "bitcoind_passwd"],
["BITCOIND_SERVER", "BITCOIND_PORT", "BITCOIND_USER", "BITCOIND_PASSWD"],
):
if hasattr(args, argname) and getattr(args, argname) is not None:
bitcoin_opts[argname] = getattr(args, argname)
setattr(config, config_name, getattr(args, argname))
if hasattr(args, "bitcoind_use_https"):
if args.bitcoind_use_https:
config.BITCOIND_USE_HTTPS = True
bitcoin_opts["bitcoind_use_https"] = True
if args.action == "start":
stop_server()
if args.foreground:
log.info("Initializing blockstored server in foreground ...")
run_server(foreground=True)
while 1:
stay_alive = True
else:
log.info("Starting blockstored server ...")
run_server()
elif args.action == "stop":
stop_server()
开发者ID:alexwzk,项目名称:blockstore,代码行数:53,代码来源:blockstored.py
示例11: tryAuth
def tryAuth(self, kind):
kind = kind.replace("-", "_")
if kind != "publickey":
log.info("skipping auth method %s (not supported)" % kind)
return
log.info("trying to auth with %s!" % kind)
f = getattr(self, "auth_%s" % kind, None)
if f:
return f()
else:
return
开发者ID:Roguelazer,项目名称:Tron,代码行数:12,代码来源:ssh.py
示例12: vnclog
def vnclog():
usage = '%prog [options] OUTPUT'
description = 'Capture user interactions with a VNC Server'
op = optparse.OptionParser(usage=usage, description=description)
add_standard_options(op)
op.add_option('--listen', metavar='PORT', type='int',
help='listen for client connections on PORT [%default]')
op.set_defaults(listen=5902)
op.add_option('--forever', action='store_true',
help='continually accept new connections')
op.add_option('--viewer', action='store', metavar='CMD',
help='launch an interactive client using CMD [%default]')
options, args = op.parse_args()
setup_logging(options)
options.host, options.port = parse_host(options.server)
if len(args) != 1:
op.error('incorrect number of arguments')
output = args[0]
factory = build_proxy(options)
if options.forever and os.path.isdir(output):
factory.output = output
elif options.forever:
op.error('--forever requires OUTPUT to be a directory')
elif output == '-':
factory.output = sys.stdout
else:
factory.output = open(output, 'w')
if options.listen == 0:
log.info('accepting connections on ::%d', factory.listen_port)
factory.password = options.password
if options.viewer:
cmdline = '%s localhost::%s' % (options.viewer, factory.listen_port)
proc = reactor.spawnProcess(ExitingProcess(),
options.viewer, cmdline.split(),
env=os.environ)
reactor.run()
sys.exit(reactor.exit_status)
开发者ID:csssuf,项目名称:vncdotool,代码行数:52,代码来源:command.py
示例13: run_blockmirrord
def run_blockmirrord():
""" run blockmirrord
"""
global blockmirrord
global bitcoind
global namecoind
global cached_namespace
signal.signal(signal.SIGINT, signal_handler)
bitcoin_opts, parser = blockdaemon.parse_bitcoind_args( return_parser=True )
namecoin_opts, parser = parse_namecoind_args( return_parser=True, parser=parser )
parser.add_argument(
"--namespace",
help="path to the cached namespace JSON file")
subparsers = parser.add_subparsers(
dest='action', help='the action to be taken')
parser_server = subparsers.add_parser(
'start',
help='start the blockmirrord server')
parser_server.add_argument(
'--foreground', action='store_true',
help='start the blockmirrord server in foreground')
parser_server = subparsers.add_parser(
'stop',
help='stop the blockmirrord server')
args, _ = parser.parse_known_args()
# did we get a namespace JSON file?
if hasattr( args, "namespace" ) and getattr( args, "namespace" ) is not None:
namespace_path = args.namespace
namespace_json = None
log.info("Loading JSON from '%s'" % namespace_path)
with open(namespace_path, "r") as namespace_fd:
namespace_json = namespace_fd.read()
log.info("Parsing JSON")
try:
cached_namespace = json.loads( namespace_json )
except Exception, e:
log.exception(e)
exit(1)
开发者ID:hotelzululima,项目名称:blockstore,代码行数:49,代码来源:blockmirrord.py
示例14: run_blockstored
def run_blockstored():
""" run blockstored
"""
parser = argparse.ArgumentParser(
description='Blockstore Core Daemon version {}'.format(config.VERSION))
parser.add_argument(
'--bitcoind-server',
help='the hostname or IP address of the bitcoind RPC server')
parser.add_argument(
'--bitcoind-port', type=int,
help='the bitcoind RPC port to connect to')
parser.add_argument(
'--bitcoind-user',
help='the username for bitcoind RPC server')
parser.add_argument(
'--bitcoind-passwd',
help='the password for bitcoind RPC server')
subparsers = parser.add_subparsers(
dest='action', help='the action to be taken')
parser_server = subparsers.add_parser(
'start',
help='start the blockstored server')
parser_server.add_argument(
'--foreground', action='store_true',
help='start the blockstored server in foreground')
parser_server = subparsers.add_parser(
'stop',
help='stop the blockstored server')
# Print default help message, if no argument is given
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
if args.action == 'start':
stop_server()
if args.foreground:
log.info('Initializing blockstored server in foreground ...')
run_server(foreground=True)
while(1):
stay_alive = True
else:
log.info('Starting blockstored server ...')
run_server()
elif args.action == 'stop':
stop_server()
开发者ID:frrp,项目名称:blockstore,代码行数:49,代码来源:blockstored.py
示例15: receiveDebug
def receiveDebug( self, alwaysDisplay, message, lang ):
"""
Called when a debug message was received from the device.
@param alwaysDisplay: boolean-type code to indicate if the message is to be displayed
@type alwaysDisplay: integer
@param message: debug message from remote device
@type message: string
@param lang: language code
@type lang: integer
"""
message= "Debug message from remote device (%s): %s" % ( str(lang), str(message) )
log.info( message )
transport.SSHClientTransport.receiveDebug(self, alwaysDisplay, message, lang )
开发者ID:sheva-serg,项目名称:executor,代码行数:15,代码来源:zenosshclient.py
示例16: run_server
def run_server(foreground=False):
""" run the blockstored server
"""
global bitcoind
prompt_user_for_chaincom_details()
bitcoind = init_bitcoind()
from .lib.config import BLOCKSTORED_PID_FILE, BLOCKSTORED_LOG_FILE
from .lib.config import BLOCKSTORED_TAC_FILE
from .lib.config import START_BLOCK
working_dir = get_working_dir()
current_dir = os.path.abspath(os.path.dirname(__file__))
tac_file = os.path.join(current_dir, BLOCKSTORED_TAC_FILE)
log_file = os.path.join(working_dir, BLOCKSTORED_LOG_FILE)
pid_file = os.path.join(working_dir, BLOCKSTORED_PID_FILE)
start_block, current_block = get_index_range()
if foreground:
command = 'twistd --pidfile=%s -noy %s' % (pid_file, tac_file)
else:
command = 'twistd --pidfile=%s --logfile=%s -y %s' % (pid_file,
log_file,
tac_file)
try:
# refresh_index(335563, 335566, initial_index=True)
if start_block != current_block:
refresh_index(start_block, current_block, initial_index=True)
blockstored = subprocess.Popen(
command, shell=True, preexec_fn=os.setsid)
log.info('Blockstored successfully started')
except IndexError, ie:
# indicates that we don't have the latest block
log.error("\n\nFailed to find the first blockstore record (got block %s).\n" % current_block + \
"Please verify that your bitcoin provider has " + \
"processed up to block %s.\n" % (START_BLOCK) + \
" Example: bitcoin-cli getblockcount" )
try:
os.killpg(blockstored.pid, signal.SIGTERM)
except:
pass
exit(1)
开发者ID:MarkBruns,项目名称:blockstore,代码行数:48,代码来源:blockstored.py
示例17: run_server
def run_server( bitcoind, foreground=False):
""" run the blockmirrord server
"""
global blockmirrord
if bitcoind is None:
bitcoind = blockdaemon.init_bitcoind( config.BLOCKMIRRORD_WORKING_DIR, config.BLOCKMIRRORD_CONFIG_FILE )
from .lib.config import BLOCKMIRRORD_PID_FILE, BLOCKMIRRORD_LOG_FILE
from .lib.config import BLOCKMIRRORD_TAC_FILE
working_dir = blockdaemon.get_working_dir( config.BLOCKMIRRORD_WORKING_DIR )
current_dir = os.path.abspath(os.path.dirname(__file__))
tac_file = os.path.join(current_dir, BLOCKMIRRORD_TAC_FILE)
log_file = os.path.join(working_dir, BLOCKMIRRORD_LOG_FILE)
pid_file = os.path.join(working_dir, BLOCKMIRRORD_PID_FILE)
start_block, current_block = get_index_range()
if foreground:
command = 'twistd --pidfile=%s -noy %s' % (pid_file, tac_file)
else:
command = 'twistd --pidfile=%s --logfile=%s -y %s' % (pid_file,
log_file,
tac_file)
try:
# bring the mirror up to speed
refresh_mirror()
# begin serving
blockmirrord = subprocess.Popen( command, shell=True, preexec_fn=os.setsid)
log.info('Blockmirrord successfully started')
except IndexError, ie:
traceback.print_exc()
try:
os.killpg(blockmirrord.pid, signal.SIGTERM)
except:
pass
exit(1)
开发者ID:hotelzululima,项目名称:blockstore,代码行数:47,代码来源:blockmirrord.py
示例18: run_server
def run_server(foreground=False):
""" run the blockstored server
"""
global bitcoind
prompt_user_for_chaincom_details()
bitcoind = init_bitcoind()
from .lib.config import BLOCKSTORED_PID_FILE, BLOCKSTORED_LOG_FILE
from .lib.config import BLOCKSTORED_TAC_FILE
from .lib.config import START_BLOCK
working_dir = get_working_dir()
current_dir = os.path.abspath(os.path.dirname(__file__))
tac_file = os.path.join(current_dir, BLOCKSTORED_TAC_FILE)
log_file = os.path.join(working_dir, BLOCKSTORED_LOG_FILE)
pid_file = os.path.join(working_dir, BLOCKSTORED_PID_FILE)
start_block, current_block = get_index_range()
if foreground:
command = 'twistd --pidfile=%s -noy %s' % (pid_file, tac_file)
else:
command = 'twistd --pidfile=%s --logfile=%s -y %s' % (pid_file,
log_file,
tac_file)
try:
# refresh_index(335563, 335566, initial_index=True)
if start_block != current_block:
refresh_index(start_block, current_block, initial_index=True)
blockstored = subprocess.Popen(
command, shell=True, preexec_fn=os.setsid)
log.info('Blockstored successfully started')
except Exception as e:
log.debug(e)
log.info('Exiting blockstored server')
try:
os.killpg(blockstored.pid, signal.SIGTERM)
except:
pass
exit(1)
开发者ID:frrp,项目名称:blockstore,代码行数:45,代码来源:blockstored.py
示例19: ready_client
def ready_client(reactor, netloc, topic):
"""
Connect to a Kafka broker and wait for the named topic to exist.
This assumes that ``auto.create.topics.enable`` is set in the broker
configuration.
:raises: `KafkaUnavailableError` if unable to connect.
"""
client = KafkaClient(netloc, reactor=reactor)
e = True
while e:
yield client.load_metadata_for_topics(topic)
e = client.metadata_error_for_topic(topic)
if e:
log.info("Error getting metadata for topic %r: %s (will retry)",
topic, e)
defer.returnValue(client)
开发者ID:Mato-Z,项目名称:cowrie,代码行数:19,代码来源:kafka.py
示例20: get_index_range
def get_index_range(start_block=0):
"""
"""
from lib.config import FIRST_BLOCK_MAINNET
if start_block == 0:
start_block = FIRST_BLOCK_MAINNET
try:
current_block = int(bitcoind.getblockcount())
except:
log.info("ERROR: Cannot connect to bitcoind")
user_input = raw_input(
"Do you want to re-enter bitcoind server configs? (yes/no): ")
if user_input.lower() == "yes" or user_input.lower() == "y":
prompt_user_for_bitcoind_details()
log.info("Exiting. Restart blockstored to try the new configs.")
exit(1)
else:
exit(1)
working_dir = get_working_dir()
lastblock_file = os.path.join(
working_dir, config.BLOCKSTORED_LASTBLOCK_FILE)
saved_block = 0
if os.path.isfile(lastblock_file):
fin = open(lastblock_file, 'r')
saved_block = fin.read()
saved_block = int(saved_block)
fin.close()
if saved_block == 0:
pass
elif saved_block == current_block:
start_block = saved_block
elif saved_block < current_block:
start_block = saved_block + 1
return start_block, current_block
开发者ID:frrp,项目名称:blockstore,代码行数:42,代码来源:blockstored.py
注:本文中的twisted.python.log.info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论