/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.trace;

import org.slf4j.LoggerFactory;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public final class LoggerUtils {
    
    private LoggerUtils() {
        /* utility class */
    }
    
    /**
     * Returns logger for the "current" class, so you don't have to hardcode class name.
     * @return 
     */
    public static org.slf4j.Logger getLogger() {
        return LoggerFactory.getLogger(TraceUtils.getCallerName());
    }
    
    public static void setThreadLogger(org.slf4j.Logger logger) {
        Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> {
            logger.error("Abnormal termination of thread: " + thread.getName(), exception);
        });
    }
    
}
