// 
// Decompiled by Procyon v0.6.0
// 

package org.bson.diagnostics;

import org.bson.assertions.Assertions;

public final class Loggers
{
    private static final String PREFIX = "org.bson";
    private static final boolean USE_SLF4J;
    
    public static Logger getLogger(final String suffix) {
        Assertions.notNull("suffix", suffix);
        if (suffix.startsWith(".") || suffix.endsWith(".")) {
            throw new IllegalArgumentException("The suffix can not start or end with a '.'");
        }
        final String name = "org.bson." + suffix;
        if (Loggers.USE_SLF4J) {
            return new SLF4JLogger(name);
        }
        return new NoOpLogger(name);
    }
    
    private static boolean shouldUseSLF4J() {
        try {
            Class.forName("org.slf4j.Logger");
            return true;
        }
        catch (final ClassNotFoundException e) {
            java.util.logging.Logger.getLogger("org.bson").warning(String.format("SLF4J not found on the classpath. Logging is disabled for the '%s' component", "org.bson"));
            return false;
        }
    }
    
    private Loggers() {
    }
    
    static {
        USE_SLF4J = shouldUseSLF4J();
    }
}
