Exemplo n.º 1
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)
Exemplo n.º 2
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,