def get_comments(ip_address): #loggers = logging_handler.get_loggers(create_tables=False) #supported_loggers = [] #for logger in loggers: # if logger.__class__.__name__ in ('LogPostgreSQL',): # supported_loggers.append(logger) #if len(supported_loggers) > 0: # return supported_loggers[0].get_comments(ip_address) #else: # return '' work_dir = os.getcwd() data_dir = os.path.join(work_dir, 'data') loggers = logging_handler.get_aux_loggers(data_dir, work_dir) for _logger in loggers: if type(_logger) is LogProfiler: return _logger.get_comments(ip_address) else: logger.info('An issue occured with the dedicated logger. Please check the configuration file.') return ''
def add_comment(ip_address, comment): #======================================================================= # loggers = logging_handler.get_loggers(create_tables=False) # supported_loggers = [] # for logger in loggers: # if logger.__class__.__name__ in ('Database',): # supported_loggers.append(logger) # for logger in supported_loggers: # logger.add_comment(ip_address, comment) #======================================================================= work_dir = os.getcwd() data_dir = os.path.join(work_dir, 'data') loggers = logging_handler.get_aux_loggers(data_dir, work_dir) for _logger in loggers: if type(_logger) is LogProfiler: _logger.add_comment(ip_address, comment) break else: logger.info('An issue occured with the dedicated logger. Please check the configuration file.')
def get_comments(ip_address): #loggers = logging_handler.get_loggers(create_tables=False) #supported_loggers = [] #for logger in loggers: # if logger.__class__.__name__ in ('LogPostgreSQL',): # supported_loggers.append(logger) #if len(supported_loggers) > 0: # return supported_loggers[0].get_comments(ip_address) #else: # return '' work_dir = os.getcwd() data_dir = os.path.join(work_dir, 'data') loggers = logging_handler.get_aux_loggers(data_dir, work_dir) for _logger in loggers: if type(_logger) is LogProfiler: return _logger.get_comments(ip_address) else: logger.info( 'An issue occured with the dedicated logger. Please check the configuration file.' ) return ''
def add_comment(ip_address, comment): #======================================================================= # loggers = logging_handler.get_loggers(create_tables=False) # supported_loggers = [] # for logger in loggers: # if logger.__class__.__name__ in ('Database',): # supported_loggers.append(logger) # for logger in supported_loggers: # logger.add_comment(ip_address, comment) #======================================================================= work_dir = os.getcwd() data_dir = os.path.join(work_dir, 'data') loggers = logging_handler.get_aux_loggers(data_dir, work_dir) for _logger in loggers: if type(_logger) is LogProfiler: _logger.add_comment(ip_address, comment) break else: logger.info( 'An issue occured with the dedicated logger. Please check the configuration file.' )