package com.playwrightdemo.utils;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class LoggerUtils {

    private static final Logger logger = LogManager.getLogger(LoggerUtils.class);

        public static void logTestMethodName(String status) {

            StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
            String methodName = stackTraceElements[2].getMethodName();

            logger.info("Test method '" + methodName + "' " + status);
        }



    public static void logInfo(String message, String methodName, String status ) {

        logger.info("Test method '" + methodName + "' " + status);

    }

    public static void logDebug(String message, String methodName, String status ) {

        logger.debug("Test method '" + methodName + "' " + status);

    }

    public static void logWarning(String message, String methodName, String status ) {

        logger.warn("Test method '" + methodName + "' " + status);

    }

    public static void logError(String message,String methodName, String status, Throwable throwable) {

            String errorMsg=message+"--"+methodName;
           logger.error(errorMsg, throwable);
    }


    }








