Configure the logging for an app using reliure (it log's both the app and reliure lib)

    :param appname: the name of the application to log
    :parap app_log_level: log level for the app
    :param log_level: log level for the reliure
    :param logfile: file that store the log, time rotating file (by day), no if None

def get_app_logger_color(appname, app_log_level=logging.INFO, log_level=logging.WARN, logfile=None):
    """ Configure the logging for an app using reliure (it log's both the app and reliure lib)

    :param appname: the name of the application to log
    :parap app_log_level: log level for the app
    :param log_level: log level for the reliure
    :param logfile: file that store the log, time rotating file (by day), no if None
    """
    # create lib handler
    stderr_handler = logging.StreamHandler()
    stderr_handler.setLevel(log_level)
    # create formatter and add it to the handlers
    name = "reliure"
    name += "_"*(max(0, len(appname)-len(name)))
    formatter = ColorFormatter('$BG-BLUE$WHITE%s$RESET:%%(asctime)s:$COLOR%%(levelname)s$RESET:$BOLD%%(name)s$RESET: %%(message)s' % name)
    stderr_handler.setFormatter(formatter)
    # get the logers it self
    logger = logging.getLogger("reliure")
    logger.setLevel(logging.DEBUG)
    # add the handlers to the loggers
    logger.addHandler(stderr_handler)
    
    # create app handler
    app_stderr_handler = logging.StreamHandler()
    app_stderr_handler.setLevel(app_log_level)
    # create formatter and add it to the handlers
    app_formatter = ColorFormatter("$BG-CYAN$WHITE%s$RESET:%%(asctime)s:$COLOR%%(levelname)s$RESET:$BOLD%%(name)s$RESET: %%(message)s" % appname.upper())
    app_stderr_handler.setFormatter(app_formatter)
    # get the logers it self
    app_logger = logging.getLogger(appname)
    app_logger.setLevel(logging.DEBUG)
    # add the handlers to the loggers
    app_logger.addHandler(app_stderr_handler)

    if logfile is not None:
        file_format = '%(asctime)s:%(levelname)s:%(name)s: %(message)s'
        from logging.handlers import TimedRotatingFileHandler
        file_handler = TimedRotatingFileHandler(logfile, when="D", interval=1, backupCount=7)
        file_handler.setFormatter(logging.Formatter(file_format))
        # add the handlers to the loggers
        logger.addHandler(file_handler)
        # add the handlers to the loggers
        app_logger.addHandler(file_handler)
    return app_logger