Example #1
0
"""
@author: george

"""
import os, logging
from configmanager import ConfigurationManager

LOG_PATH = ConfigurationManager.readLogConfig(variable="log_path")
ERROR_FILENAME = ConfigurationManager.readLogConfig(variable="error_filename")
WARNING_FILENAME = ConfigurationManager.readLogConfig(variable="warning_filename")
DEBUG_FILENAME = ConfigurationManager.readLogConfig(variable="debug_filename")
CRITICAL_FILENAME = ConfigurationManager.readLogConfig(variable="critical_filename")
INFO_FILENAME = ConfigurationManager.readLogConfig(variable="info_filename")
FORMAT = ConfigurationManager.readLogConfig(variable="format")
DATEFORMAT = ConfigurationManager.readLogConfig(variable="dateformat")


class Logger:
    """
    Give tools for manipulation of log files 
    """

    def __init__(
        self,
        logFormat=FORMAT,
        logDateFormat=DATEFORMAT,
        errorFilename=ERROR_FILENAME,
        warningFilename=WARNING_FILENAME,
        debugFilename=DEBUG_FILENAME,
        criticalFilename=CRITICAL_FILENAME,
        infoFilename=INFO_FILENAME,
Example #2
0
'''
@author: george

'''
import os
import logging

from configmanager import ConfigurationManager

LOG_PATH = ConfigurationManager.readLogConfig(variable = 'log_path')
ERROR_FILENAME = ConfigurationManager.readLogConfig(variable = 'error_filename')
WARNING_FILENAME = ConfigurationManager.readLogConfig(variable = 'warning_filename')
DEBUG_FILENAME = ConfigurationManager.readLogConfig(variable = 'debug_filename')
CRITICAL_FILENAME = ConfigurationManager.readLogConfig(variable = 'critical_filename')
INFO_FILENAME = ConfigurationManager.readLogConfig(variable = 'info_filename')
FORMAT =ConfigurationManager.readLogConfig(variable = 'format')
DATEFORMAT =ConfigurationManager.readLogConfig(variable = 'dateformat')

class Logger():
    '''
    Give tools for manipulation of log files 
    '''

    def __init__(self,logFormat = FORMAT,logDateFormat=DATEFORMAT,errorFilename=ERROR_FILENAME,warningFilename = WARNING_FILENAME,debugFilename=DEBUG_FILENAME,criticalFilename = CRITICAL_FILENAME,infoFilename=INFO_FILENAME,logPath=LOG_PATH):
        self.logFormat = logFormat
        self.log_date_format= logDateFormat
        self.errorFilePath = os.path.join(logPath,errorFilename)
        self.warningFilePath = os.path.join(logPath,warningFilename)
        self.debugFilePath = os.path.join(logPath,debugFilename)
        self.criticalFilePath = os.path.join(logPath,criticalFilename)
        self.infoFilePath = os.path.join(logPath,infoFilename)
Example #3
0
'''
@author: george
'''
import os
from configmanager import ConfigurationManager
from xml.etree import ElementTree
XML_PATH = ConfigurationManager.readxmlConfig(variable='xml_path')
XML_CREATED_PATH=os.path.join(XML_PATH,'xml_created')

class XMLhandler():
    '''
    Class XMLhandler load an xml file and manage it.
    '''


    def __init__(self, filename=None):
        self.filepath= os.path.join(XML_CREATED_PATH,filename)
        self.etree = ElementTree.parse(self.filepath)
        
    def returnListofValuesC(self):
        '''
        XMLhandler method return a list of values from an xml file
        '''
        values =[]
        for value in self.etree.findall('./'):
            values.append(value.text)
        return values
    
    def returnDictofValuesC(self):
        '''
        XMLhandler method return a dict of values from an xml file