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

org.nustaq.logging.FSTLogger Maven / Gradle / Ivy

Go to download

A fast java serialization drop in-replacement and some serialization based utils such as Structs and OffHeap Memory.

There is a newer version: 3.0.4-jdk17
Show newest version
package org.nustaq.logging;

public final class FSTLogger {

    private static Log binding;

    /**
     * Initialize FST logging with a {@link Log} binding.
     * @param log
     */
    public static void setBinding(Log log) {
        binding = log;
    }

    public static FSTLogger getLogger(Class clazz) {
        return new FSTLogger(clazz.getName());
    }

    private final String loggerName;
    private FSTLogger(String loggerName) {
        this.loggerName = loggerName;
    }

    public void log(Level level, String message, /* nullable */ Throwable ex) {
        if (binding != null) {
            binding.log(loggerName, level, message, ex);
        }
    }

    public enum Level {
        TRACE,
        DEBUG,
        INFO,
        WARN,
        ERROR
    }

    public interface Log {

        void log(String name, Level level, String message, /* nullable */ Throwable ex);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy