<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setup_logging(name, prefix="trademanager", cfg=None):
 """ Create a logger, based on the given configuration. Accepts LOGFILE and LOGLEVEL settings. :param name: the name of the tapp to log :param cfg: The configuration object with logging info. :return: The session and the engine as a list (in that order) """

    logname = "/var/log/%s/%s_tapp.log" % (prefix, name)
    logfile = cfg.get('log', 'LOGFILE') if cfg is not None and \
        cfg.get('log', 'LOGFILE') is not None and cfg.get('log', 'LOGFILE') != "" else logname
    loglevel = cfg.get('log', 'LOGLEVEL') if cfg is not None and \
        cfg.get('log', 'LOGLEVEL') is not None else logging.INFO
    logging.basicConfig(filename=logfile, level=loglevel)
    return logging.getLogger(name)