本文整理汇总了Python中common.logger.Logger.put方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.put方法的具体用法?Python Logger.put怎么用?Python Logger.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.logger.Logger
的用法示例。
在下文中一共展示了Logger.put方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_vhost_conf
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def render_vhost_conf(self):
template = self.env.get_template('vhost.conf.j2')
for virtual_host in self.virtual_hosts:
nginx_config = template.render(virtual_host=virtual_host)
virtual_host_conf = os.path.join(self.nginx.files_dir, virtual_host.conf)
with open(virtual_host_conf, 'w+') as dest:
Logger.put("{}を生成したよー".format(virtual_host_conf))
dest.write(nginx_config.encode('utf-8'))
示例2: process_do_maintenance
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def process_do_maintenance(self):
""" メンテナンスの設定を行う
"""
if self.operation.maintenance_mode:
self.operation.render_maintenance_config()
self.operation.cp_maintenance_config()
self.operation.nginx.restart()
Logger.put('メンテナンスを{}にしたよ'.format(self.operation.maintenance_mode))
示例3: parse_json
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def parse_json(self):
init_data = {}
if not isinstance(self.item['data'], str):
return False
try:
init_data = json.loads(self.item['data'])
except:
Logger.put("JSONにできないやつ送られてきた!. {}".format(self.item['data']))
return False
self.operation = Operation(init_data)
return True
示例4: cp
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def cp(self, _from, _to):
""" cp _from _to
@param _from str file path
@param _to str file path
@return Popen#returncode, res, err
"""
cp = 'cp -rf {} {}'.format(_from, _to),
# DEBUG
Logger.put(cp)
ret_code, res, err = shell_command(cp)
return ret_code, res, err
示例5: run
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def run(self):
while True:
try:
for self.item in self.pubsub.listen():
if self.parse_json():
self.process_do_maintenance()
self.process_do_changed_enable()
except:
import traceback
Logger.put(traceback.format_exc())
finally:
# コケたら1秒sleep
Logger.put('Failed SUBSCRIBE')
# 再度
self.pubsub.subscribe(self.channels)
Logger.put('SUBSCRIBE channels {}'.format(self.channels))
time.sleep(1)
示例6: restart
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def restart(self):
Logger.put("restart nginx...")
return self.initd('restart')
示例7: reload
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def reload(self):
Logger.put("reload nginx...")
return self.initd('reload')
示例8: render_maintenance_config
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import put [as 别名]
def render_maintenance_config(self):
template = self.env.get_template('nginx.conf.j2')
nginx_config = template.render(maintenance=self.maintenance_mode)
with open(self.nginx.maintenance_conf, 'w+') as dest:
dest.write(nginx_config.encode('utf-8'))
Logger.put("maintenance.conf作成したよー")