import inspect
import logging
import pdb

import allure


def customLogger(logLevel=logging.DEBUG):
    #Get the name of the class/method from where this method is called
    loggerName=inspect.stack()[1][3]
    logger=logging.getLogger(loggerName)
    #by default, log all messages
    logger.setLevel(logging.INFO)
    fileHandler=logging.FileHandler("automation.log",mode="a")
    fileHandler.setLevel(logLevel)
    formatter=logging.Formatter('%(asctime)s - %(name)s - %(funcName)s - %(levelname)s: %(message)s',
                    datefmt='%m/%d/%Y %I:%M:%S %p')
    fileHandler.setFormatter(formatter)
    logger.addHandler(fileHandler)
    return logger

def allureLogs(text):
    with allure.step(text):
        pass