本文整理汇总了Python中com.cloudMedia.theKuroBox.sdk.util.logger.Logger.log_warning方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.log_warning方法的具体用法?Python Logger.log_warning怎么用?Python Logger.log_warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloudMedia.theKuroBox.sdk.util.logger.Logger
的用法示例。
在下文中一共展示了Logger.log_warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __add_scheduler
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def __add_scheduler(ruleId, kbxMethodIdentifier, second, minute, hour, dayOfMonth, month, dayOfWeek):
'''
second="0", minute="*", hour="*", dayOfMonth="*", month="*", dayOfWeek="*"
'''
try:
uniqueName = "_".join([kbxMethodIdentifier, second, minute, hour, dayOfMonth, month, dayOfWeek])
schedulerName = hash(uniqueName)
if schedulerName not in TimerModule.SCHEDULER_ID_TRACKER:
SchedulerService.add_cron_job(str(schedulerName),
kbxTargetAppId=AppInfo.get_app_id(),
kbxTargetMethod="scheduler_callback",
kbxTargetModule="timer_module",
second=second,
minute=minute,
hour=hour,
dayOfMonth=dayOfMonth,
month=month,
dayOfWeek=dayOfWeek,
kbxTargetParams={"kbxMethodIdentifier":kbxMethodIdentifier},
store=False)
TimerModule.SCHEDULER_ID_TRACKER[schedulerName] = [ruleId]
TimerModule.RULE_ID_SCHEDULER_TRACKER[ruleId] = [schedulerName]
Logger.log_debug("Added Timer:", schedulerName, uniqueName)
else:
TimerModule.SCHEDULER_ID_TRACKER[schedulerName].append(ruleId)
TimerModule.RULE_ID_SCHEDULER_TRACKER[ruleId].append(schedulerName)
except Exception as e:
Logger.log_warning("Failed to add timer:", e)
示例2: __on_record_deleted
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def __on_record_deleted(self, kbxMethodId, kbxMethodEvent, kbxMethodIdentifier):
result = self.__db.execute('SELECT COUNT(kbxMethodId) AS "total" FROM "event" WHERE "kbxMethodEvent"=?', (kbxMethodEvent,)).fetchall()
if result[0]["total"] == 0:
try:
self.on_event_deleted(kbxMethodEvent)
except Exception as e:
Logger.log_warning("EventController.__on_record_added ex:", e, "- tag:", kbxMethodEvent)
示例3: on_group_icon_change
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def on_group_icon_change(*args, **kwargs):
with self.__lock___group_icon_change:
for callback in self.__group_icon_change_callbacks:
try:
callback(*args, **kwargs)
except Exception as e:
Logger.log_warning("GroupController.listen_to_group_icon_change.on_group_icon_change callback ex:", e)
示例4: kbx_method_after_delete
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def kbx_method_after_delete(self, kbxMethodId, kbxGroupId):
if Util.is_empty(kbxGroupId):
return
self.__delete_kbx_group_if_necessary(kbxGroupId)
try:
Database.KBX_METHOD_AFTER_DELETE(kbxMethodId)
except Exception as e:
Logger.log_warning("Database.KBX_METHOD_AFTER_DELETE raised error:", e)
示例5: on_method_status_change
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def on_method_status_change(*args, **kwargs):
with self.__lock___method_status_change:
for callback in self.__method_status_change_callbacks:
try:
callback(*args, **kwargs)
except Exception as e:
Logger.log_warning("MethodController.listen_to_method_status_change.on_method_status_change callback ex:", e)
示例6: __get_arg
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def __get_arg(keyName, methodParams):
'''
Method to parse out corresponding value from methodParams.
'''
for methodParam in methodParams:
if methodParam.get(AppConstants.ARG_NAME) == keyName:
return methodParam.get(AppConstants.ARG_CURRENT_VALUE)
else:
Logger.log_warning("Unable to find value:", keyName)
return None
示例7: reset
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def reset(self):
result = self.__db.execute('SELECT DISTINCT "kbxMethodEvent" FROM "event"').fetchall()
for row in result:
kbxMethodEvent = row["kbxMethodEvent"]
try:
self.on_event_deleted(kbxMethodEvent)
except Exception as e:
Logger.log_warning("EventController.reset on_event_removed ex:", e, "- tag:", kbxMethodEvent)
self.__db.close()
self.__init__()
示例8: handle_dow
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def handle_dow(ruleId, methodParams):
with TimerModule.SCHEDULER_LOCK:
keyName = TimerModule._PARAM_DOW.get_kbx_param_name()
dowVal = TimerModule.__get_arg(keyName, methodParams)
try:
dowVal = TimerModule._PARAM_DOW.cast(dowVal)
except Exception as e:
Logger.log_warning("Invalid day of week value, val:", dowVal, "ex:", e)
return
# Add scheduler
dayOfWeek = ",".join((str(d) for d in dowVal))
TimerModule.__add_scheduler(ruleId, "day_of_week", "0", "0", "0", "*", "*", dayOfWeek)
示例9: handle_date_time_range
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def handle_date_time_range(ruleId, methodParams):
with TimerModule.SCHEDULER_LOCK:
keyName = TimerModule._PARAM_DT_RANGE.get_kbx_param_name()
dtVal = TimerModule.__get_arg(keyName, methodParams)
try:
dtVal = TimerModule._PARAM_DT_RANGE.cast(dtVal)
except Exception as e:
Logger.log_warning("Invalid date time range value, val:", dtVal, "ex:", e)
return
# Add scheduler
startDateTime = dtVal.get_start_date_time()
dtObj = startDateTime.get_date_time_obj()
weekday = dtObj.isoweekday() % 7
TimerModule.__add_scheduler(ruleId, "date_time_range", str(dtObj.second), str(dtObj.minute), str(dtObj.hour), str(dtObj.day), str(dtObj.month), str(weekday))
示例10: delete_scheduler
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def delete_scheduler(ruleId):
with TimerModule.SCHEDULER_LOCK:
try:
schedulerNames = TimerModule.RULE_ID_SCHEDULER_TRACKER.pop(ruleId, set({}))
for schedulerName in schedulerNames:
TimerModule.SCHEDULER_ID_TRACKER[schedulerName].remove(ruleId)
if not TimerModule.SCHEDULER_ID_TRACKER[schedulerName]:
SchedulerService.remove_job(str(schedulerName))
del(TimerModule.SCHEDULER_ID_TRACKER[schedulerName])
Logger.log_debug("Removed Timer:", schedulerName)
except Exception as e:
Logger.log_warning("Failed to remove timer:", e)
示例11: register_timer_module_schedulers
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def register_timer_module_schedulers(self):
# TODO: REMEMBER TO ADD index to kbxMethodId
timerModuleHnds = {TimerModule.METHOD_ID_DATE_TIME_RANGE: TimerModule.handle_date_time_range,
TimerModule.METHOD_ID_TIME_RANGE: TimerModule.handle_time_range,
TimerModule.METHOD_ID_DAY_OF_WEEK: TimerModule.handle_dow}
timerMethodIds = (TimerModule.METHOD_ID_DATE_TIME_RANGE, TimerModule.METHOD_ID_TIME_RANGE, TimerModule.METHOD_ID_DAY_OF_WEEK)
result = self.__db.execute_and_fetch_all('SELECT "rcRuleId", "kbxMethodId", "kbxMethodParams" FROM "rule_condition" WHERE "kbxMethodId" IN (?, ?, ?)',
timerMethodIds)
for row in result:
try:
timerModuleHnd = timerModuleHnds[row["kbxMethodId"]]
timerModuleHnd(row["rcRuleId"], row["kbxMethodParams"])
except Exception as e:
Logger.log_warning("BootstrapService.register_timer_module_schedulers ex:", e, "-- debug info --", dict(row))
示例12: __broadcast_group_status_update
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def __broadcast_group_status_update(self, eventObj):
'''
Broadcast group updated status so that UI listen to the changes.
'''
try:
eventTag = eventObj["eventTag"]
eventData = json.loads(eventObj["eventData"])
# Check if group parent id belongs to groups in automation.
dataToBroadcast = {"kbxGroupId":eventData["kbxGroupId"],
"kbxGroupParentId":eventData["kbxGroupParentId"],
"enabled":bool((eventData.get("enabled", True) is not False) and eventTag != Event.EVENT_SHARED_METHOD_GROUP_DELETED)}
eventTagsToBroadcast = {Event.EVENT_SHARED_METHOD_GROUP_ADDED: AppConstants.EVENT_AUTOMATION_GROUP_ADDED,
Event.EVENT_SHARED_METHOD_GROUP_UPDATED: AppConstants.EVENT_AUTOMATION_GROUP_UPDATED,
Event.EVENT_SHARED_METHOD_GROUP_DELETED: AppConstants.EVENT_AUTOMATION_GROUP_DELETED}
dataToBroadcast = json.dumps(dataToBroadcast)
self.send_web_server_event(eventTagsToBroadcast[eventTag], dataToBroadcast)
except Exception as e:
Logger.log_warning("AutomationApp __broadcast_group_status_update ex:", e)
示例13: handle_time_range
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def handle_time_range(ruleId, methodParams):
with TimerModule.SCHEDULER_LOCK:
keyName = TimerModule._PARAM_TIME_RANGE.get_kbx_param_name()
tVal = TimerModule.__get_arg(keyName, methodParams)
if tVal is not None:
try:
tVal = TimerModule._PARAM_TIME_RANGE.cast(tVal)
startTime = tVal.get_start_time()
except Exception as e:
Logger.log_warning("Invalid time range value, val:", tVal, "ex:", e)
return
else:
# Backward compatible to daily_task.
kbxTime = KBXTime(kbxParamName="time")
try:
startTime = kbxTime.cast(TimerModule.__get_arg("time", methodParams))
except Exception as e:
Logger.log_warning("Invalid time range value (old), val:", tVal, "ex:", e)
return
# Add scheduler
TimerModule.__add_scheduler(ruleId, "time_range", str(startTime.get_second()), str(startTime.get_minute()), str(startTime.get_hour()), "*", "*", "*")
示例14: delete_all_method_groups
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def delete_all_method_groups():
try:
StorageManagerService.del_data(Storage.STORAGE_METHOD_GROUP)
except Exception as e:
Logger.log_warning("Migration.Storage.delete_all_method_groups ex:", e)
示例15: __scheduler_callback
# 需要导入模块: from com.cloudMedia.theKuroBox.sdk.util.logger import Logger [as 别名]
# 或者: from com.cloudMedia.theKuroBox.sdk.util.logger.Logger import log_warning [as 别名]
def __scheduler_callback(self, request):
self.send_response({}, request.requestId)
try:
self.send_system_event(TimerModule.EVENT_TAG, "".join(("{\"kbxMethodIdentifier\":\"", str(request.get_arg("kbxMethodIdentifier")), "\"}")))
except Exception as e:
Logger.log_warning("Timer Module failed to process scheduler callback:", str(e))