本文整理汇总了Python中config.log_file方法的典型用法代码示例。如果您正苦于以下问题:Python config.log_file方法的具体用法?Python config.log_file怎么用?Python config.log_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config.log_file方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def run(self):
while len(self.files_not_sent)>0:
try:
if self._connected():
for f,now in self.files_not_sent:
try:
text="Motion detected in your room at {}. Please see attached video.\n".format(now)
sem.send_mail(files=[mp4_folder+f],text=text)
self.files_not_sent.remove((f,now))
except:
continue
if len(self.files_not_sent)>0:
with open(log_dir+log_file,'a') as f:
f.write(time.strftime("%a, %d %b %Y %H:%M:%S\n",time.localtime()))
f.write(str(self.files_not_sent))
f.write('\n')
except:
continue
示例2: config_logger
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def config_logger(verbose):
log_formatter = logging.Formatter("%(asctime)s.%(msecs)03d000 [%(processName)s-%(threadName)-12.12s] "
"[%(levelname)-5.5s] %(message)s", "%Y-%m-%d %H:%M:%S")
logging.Formatter.converter = time.gmtime
root_logger = logging.getLogger()
file_handler = logging.FileHandler(config.log_file, mode='w')
file_handler.setFormatter(log_formatter)
root_logger.addHandler(file_handler)
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(log_formatter)
root_logger.addHandler(console_handler)
if verbose:
root_logger.setLevel(logging.DEBUG)
else:
root_logger.setLevel(logging.INFO)
示例3: _fill_dialog
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def _fill_dialog(self, exc_msg, exc_type, header):
"""Fill the bug dialog
exc_msg: Short exception summary
exc_type: Exception type as string
header: Initial message
see: SetContent(), SetContentEI()"""
details = log.getBufferAsString()
if not exc_msg:
exc_msg = _('No summary available')
summary = self.st_summary.GetLabel() % { 'exc_type':exc_type, 'exc_msg':exc_msg }
self.st_header.SetLabel(header)
self.st_summary.SetLabel(summary)
self.tc_details.SetValue(details)
howto = self.tc_howto_report.GetValue()
howto = howto % {'log_file': config.log_file}
self.tc_howto_report.SetValue(howto)
示例4: logThis
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def logThis(message,type='log'):
if type=='log':
message = u"{delim}{time}{delim} {message}".format(delim="~"*30, time=datetime.now(),message=unicode(message, errors='ignore'))
log_file = config.log_file
print message
else:
log_file = config.result_file
with codecs.open(log_file, "a","utf-8") as myfile:
myfile.write(message+'\n')
示例5: get_file_names
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def get_file_names(self):
with open(log_dir+log_file,'r') as f:
alltext=f.read().split('\n')
for line in reversed(alltext):
if len(line)>2 and '[' in line: #making sure there is some content
files=eval(line)
break
else:
files=[]
return files
示例6: execute
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def execute(self):
self._pool = Pool(config.pool_processors)
self._thread_pool = ThreadPool(5)
cli_stats = CliStats(self._context, self._writer)
cli_stats.execute()
self.clean_up_docker()
logging.info(config.log_line_run_end + self._context.run_name)
_flush_log_handlers()
_extract_from_file(config.log_file, config.run_log,
config.log_line_run_start + self._context.run_name,
config.log_line_run_end + self._context.run_name)
parser = Parser(self._context, self._writer)
parser.execute()
_collect_general_information()
self._context.step_times.append(StepTimes(time.time(), 'postprocessing_end'))
self._writer.write_csv(config.step_times_csv_file_name, StepTimes.csv_header, self._context.step_times)
_create_report()
self._pool.close()
self._thread_pool.close()
logging.info('Executed post processing')
示例7: on_autosave_timer
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def on_autosave_timer(self, event):
res = common.autosave_current()
if res == 2:
self.user_message(_("Auto saving... done"))
elif not res:
self.autosave_timer.Stop()
config.preferences.autosave = False
logging.info(_('Disable autosave function permanently'))
wx.MessageBox(
_('The autosave function failed. It has been disabled\n'
'permanently due to this error. Use the preferences\n'
'dialog to re-enable this functionality.\n'
'The details have been written to the wxGlade log file\n\n'
'The log file is: %s' % config.log_file ),
_('Autosave Failed'), wx.OK | wx.CENTRE | wx.ICON_ERROR )
示例8: init_stage1
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def init_stage1(options):
"""Initialise paths for wxGlade (first stage)
Initialisation is split because the test suite doesn't work with proper initialised paths."""
config.version = config.get_version()
common.init_paths(options)
# initialise own logging extensions
log.init(filename=config.log_file, encoding='utf-8', level='INFO')
atexit.register(log.deinit)
# print versions
logging.info( _('Starting wxGlade version "%s" on Python %s'), config.version, config.py_version )
# print used paths
logging.info(_('Base directory: %s'), config.wxglade_path)
logging.info(_('Documentation directory: %s'), config.docs_path)
logging.info(_('Icons directory: %s'), config.icons_path)
logging.info(_('Build-in widgets directory: %s'), config.widgets_path)
logging.info(_('Template directory: %s'), config.templates_path)
logging.info(_('Credits file: %s'), config.credits_file)
logging.info(_('License file: %s'), config.license_file)
logging.info(_('Manual file: %s'), config.manual_file)
logging.info(_('Tutorial file: %s'), config.tutorial_file)
logging.info(_('Home directory: %s'), config.home_path)
logging.info(_('Application data directory: %s'), config.appdata_path)
logging.info(_('Configuration file: %s'), config.rc_file)
logging.info(_('History file: %s'), config.history_file)
logging.info(_('Log file: %s'), config.log_file)
# adapt application search path
sys.path.insert(0, config.wxglade_path)
sys.path.insert(1, config.widgets_path)
示例9: _set_file_paths
# 需要导入模块: import config [as 别名]
# 或者: from config import log_file [as 别名]
def _set_file_paths(options):
"Set the full path for all files (config.*_file except default_output_file)"
install_method = _get_install_method()
if install_method == 'single_directory':
config.credits_file = os.path.join(config.wxglade_path, 'CREDITS.txt')
config.license_file = os.path.join(config.wxglade_path, 'LICENSE.txt')
config.manual_file = os.path.join(config.docs_path, 'html', 'index.html')
config.bmp_manual_file = os.path.join(config.docs_path, 'html', 'bitmaps.html')
#config.tutorial_file = os.path.join(config.docs_path, 'Tutorial.html')
else:
config.credits_file = os.path.join(config.docs_path, 'CREDITS.txt')
config.license_file = os.path.join(config.docs_path, 'LICENSE.txt')
config.manual_file = os.path.join(config.docs_path, 'html', 'index.html')
config.bmp_manual_file = os.path.join(config.docs_path, 'html', 'bitmaps.html')
#config.tutorial_file = os.path.join(config.docs_path, 'html', 'tutorial.html')
if not os.path.exists(config.credits_file):
logging.error(_('Credits file "CREDITS.txt" not found!'))
config.credits_file = ''
if not os.path.exists(config.license_file):
logging.error(_('License file "LICENSE.txt" not found!'))
config.license_file = ''
config.widgets_path = os.path.join(config.wxglade_path, 'widgets')
# complete path to rc file
if options and options.rc_file:
if not os.path.exists(options.rc_file):
logging.error(_('Specified config file does not exist'))
config.rc_file = options.rc_file
elif os.name == 'nt':
config.rc_file = os.path.join(config.appdata_path, 'wxglade.ini')
else:
config.rc_file = os.path.join(config.appdata_path, 'wxgladerc')
config.history_file = os.path.join(config.appdata_path, 'file_history.txt')
config.log_file = os.path.join(config.appdata_path, 'wxglade.log')