本文整理汇总了Python中models.Log.message方法的典型用法代码示例。如果您正苦于以下问题:Python Log.message方法的具体用法?Python Log.message怎么用?Python Log.message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Log
的用法示例。
在下文中一共展示了Log.message方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _to_logs
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import message [as 别名]
def _to_logs(self, hits):
logs = []
for hit in hits:
log = Log()
log.id = hit.meta.id
log.filename = hit.filename
log.level = hit.level
log.message = hit.message
log.created_at = utils.to_datetime(hit.created_at, '%Y-%m-%d')
logs.append(log)
return logs
示例2: log
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import message [as 别名]
def log(self, msg, level=logging.INFO, append_to_last=False, fin=False):
if append_to_last:
log = Log.objects.filter(configuration=self.configuration).order_by('id').last()
log.message += msg
else:
log = Log()
log.configuration = self.configuration
log.message = msg
log.finished = fin
log.save()
示例3: emit
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import message [as 别名]
def emit(self, record):
log = Log()
obj = getattr(record, "obj", None)
if obj:
log.obj = unicode(obj)
log.name = unicode(record.name)
log.level = unicode(record.levelname)
log.module = unicode(record.module)
log.func_name = unicode(record.funcName)
log.line_no = unicode(record.lineno)
log.thread = unicode(record.thread)
log.thread_name = unicode(record.threadName)
log.process = unicode(record.process)
log.message = unicode(record.msg)
log.args = unicode(record.args)
db.session.add(log)
db.session.commit()
示例4: emit
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import message [as 别名]
def emit(self, record):
log = Log()
obj = getattr(record, "obj", None)
if obj:
log.obj = repr(obj)
log.name = record.name
log.level = record.levelname
log.module = record.module
log.func_name = record.funcName
log.line_no = record.lineno
log.thread = record.thread
log.thread_name = record.threadName
log.process = record.process
log.message = record.msg
log.args = str(record.args)
db.session.add(log)
db.session.commit()