All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.slf4j.impl.MufferoMDCAdapter Maven / Gradle / Ivy

package org.slf4j.impl;

import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import net.rumati.logging.muffero.MDC;
import org.slf4j.spi.MDCAdapter;

class MufferoMDCAdapter
    implements MDCAdapter
{
    public void put(String key, String val)
    {
        MDC.put(key, val);
    }

    public String get(String key)
    {
        return MDC.get(key);
    }

    public void remove(String key)
    {
        MDC.remove(key);
    }

    public void clear()
    {
        MDC.clear();
    }

    public Map getCopyOfContextMap()
    {
        return MDC.getCopyOfContextMap();
    }

    public void setContextMap(Map contextMap)
    {
        Map map = new TreeMap();
        for (Object o : contextMap.entrySet()){
            Map.Entry e = (Entry)o;
            map.put(e.getKey().toString(), e.getValue().toString());
        }
        MDC.setContextMap(map);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy