import base64 import logging import json import requests from kafka import KafkaProducer from kafka.errors import KafkaTimeoutError from DeviceManager.conf import CONFIG from DeviceManager.Logger import Log from datetime import datetime import time LOGGER = Log().color_log() class DeviceEvent: CREATE = "create" UPDATE = "update" REMOVE = "remove" CONFIGURE = "configure" TEMPLATE = "template.update" class NotificationMessage: event = "" data = None meta = None def __init__(self, ev, d, m): self.event = ev
from flask import Blueprint, request, jsonify, make_response from DeviceManager.conf import CONFIG from DeviceManager.Logger import Log from DeviceManager.app import app from DeviceManager.SerializationModels import parse_payload, load_attrs from DeviceManager.SerializationModels import log_schema from DeviceManager.utils import format_response, HTTPRequestError, get_pagination logger = Blueprint('log', __name__) LOG = Log() class LoggerHandler: def _init_(self): pass @staticmethod def update_log_level(level): """ Update the log level of device manager. :param level: Receive a string containing the new log level. :raises HTTPRequestError: If no authorization token was provided (no tenant was informed) or the request body contains some error. """ LOG.update_log_level(level.upper())