本文整理汇总了Python中neubot.log.LOG.use_database方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.use_database方法的具体用法?Python LOG.use_database怎么用?Python LOG.use_database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.log.LOG
的用法示例。
在下文中一共展示了LOG.use_database方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from neubot.log import LOG [as 别名]
# 或者: from neubot.log.LOG import use_database [as 别名]
def main(args):
''' Main() function '''
try:
options, arguments = getopt.getopt(args[1:], '')
except getopt.error:
sys.exit('usage: neubot background_win32')
if options or arguments:
sys.exit('usage: neubot background_win32')
# Read settings from database
CONFIG.merge_database(DATABASE.connection())
#
# Save logs into the database, to easily access
# and show them via the web user interface.
#
LOG.use_database()
# Complain if privacy settings are not OK
privacy.complain_if_needed()
background_api.start('127.0.0.1 ::1', '9774')
BACKGROUND_RENDEZVOUS.start()
__start_updater()
POLLER.loop()
示例2: main
# 需要导入模块: from neubot.log import LOG [as 别名]
# 或者: from neubot.log.LOG import use_database [as 别名]
def main(args):
""" Main function """
if not system.has_enough_privs():
sys.exit('FATAL: you must be root')
common.main("agent", "Run in background, periodically run tests", args)
conf = CONFIG.copy()
privacy.complain_if_needed()
BACKEND.use_backend("neubot")
BACKEND.datadir_init()
# FIXME We're ignoring agent.api.{address,port} that are now
# deprecated and should be removed soon.
background_api.start_api()
if conf["agent.daemonize"]:
LOG.redirect()
system.go_background()
if conf["agent.use_syslog"]:
LOG.redirect()
#
# When we run as an agent we also save logs into
# the database, to easily access and show them via
# the web user interface.
#
LOG.use_database()
logging.info('%s for POSIX: starting up', utils_version.PRODUCT)
system.drop_privileges()
if os.getuid() == 0 or os.geteuid() == 0:
logging.error('agent: still running as root')
os._exit(1)
if conf["agent.rendezvous"]:
BACKGROUND_RENDEZVOUS.start()
POLLER.loop()
logging.info('%s for POSIX: shutting down', utils_version.PRODUCT)
LOG.writeback()
#
# Make sure that we do not leave the database
# in an inconsistent state.
#
DATABASE.close()
示例3: main
# 需要导入模块: from neubot.log import LOG [as 别名]
# 或者: from neubot.log.LOG import use_database [as 别名]
def main(args):
''' Main() function '''
try:
options, arguments = getopt.getopt(args[1:], '')
except getopt.error:
sys.exit('usage: neubot background_win32')
if options or arguments:
sys.exit('usage: neubot background_win32')
# Read settings from database
CONFIG.merge_database(DATABASE.connection())
BACKEND.use_backend("neubot")
BACKEND.datadir_init()
#
# Save logs into the database, to easily access
# and show them via the web user interface.
#
LOG.use_database()
logging.info('%s for Windows: starting up', utils_version.PRODUCT)
# Complain if privacy settings are not OK
privacy.complain_if_needed()
background_api.start_api()
BACKGROUND_RENDEZVOUS.start()
__start_updater()
POLLER.loop()
logging.info('%s for Windows: shutting down', utils_version.PRODUCT)
LOG.writeback()
#
# Make sure that we do not leave the database
# in an inconsistent state.
#
DATABASE.close()
示例4: main
# 需要导入模块: from neubot.log import LOG [as 别名]
# 或者: from neubot.log.LOG import use_database [as 别名]
def main(args):
common.main("agent", "Run in background, periodically run tests", args)
conf = CONFIG.copy()
privacy.complain_if_needed()
if conf["agent.api"]:
server = HTTP_SERVER
LOG.debug("* API server root directory: %s" % WWW)
conf["http.server.rootdir"] = WWW
conf["http.server.ssi"] = True
conf["http.server.bind_or_die"] = True
server.configure(conf)
server.register_child(ServerAPI(POLLER), "/api")
server.listen((conf["agent.api.address"], conf["agent.api.port"]))
if conf["agent.daemonize"]:
system.change_dir()
system.go_background()
system.write_pidfile()
LOG.redirect()
if conf["agent.use_syslog"]:
LOG.redirect()
system.drop_privileges(LOG.error)
#
# When we run as an agent we also save logs into
# the database, to easily access and show them via
# the web user interface.
#
LOG.use_database()
if conf["agent.rendezvous"]:
client = ClientRendezvous(POLLER)
client.configure(conf)
client.connect_uri()
POLLER.loop()