import logging
import logging.config
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__)))


def getRootLogger():
    if not os.path.exists(os.path.join(os.path.dirname(__file__)) + "/logging.conf"):
        title = "Resource directory not found."
        text = "Kindly check your exe directory because resources directory not found."
        print(title, text)
    if not os.path.exists(os.path.join(os.path.dirname(__file__)) + "/log/"):
        os.makedirs(os.path.join(os.path.dirname(__file__)) + "/log/")

    logging.config.fileConfig(os.path.join(os.path.dirname(__file__)) + "/logging.conf")
    logger = logging.getLogger()
    logger.setLevel(logging.NOTSET)
    return logger
