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

com.fastchar.core.FastLog Maven / Gradle / Ivy

Go to download

FastChar is Web+ORM Framework in Java Copyright (C) http://www.fastchar.com All rights reserved.

The newest version!
package com.fastchar.core;

import com.fastchar.utils.FastClassUtils;
import com.fastchar.utils.FastDateUtils;

public final class FastLog {

    public FastLog() {
    }

    public void info(Class targetClass, String message) {
        info(targetClass, message, null);
    }

    public void info(Class targetClass, String message,Throwable throwable) {
        System.out.println("\n" + FastDateUtils.getDateString());
        System.out.println("[INFO]:" + lightStyle(message));
    }

    public void error(Class targetClass, String message) {
        error(targetClass, message, null);
    }

    public void error(Class targetClass, String message,Throwable throwable) {
        System.err.println("\n" + FastDateUtils.getDateString());
        System.err.println("[ERROR]:" + errorStyle(message));
    }

    public void warn(Class targetClass, String message) {
        warn(targetClass, message, null);
    }

    public void warn(Class targetClass, String message,Throwable throwable) {
        System.out.println("\n" + FastDateUtils.getDateString());
        System.out.println("[WARN]:" + warnStyle(message));
    }


    public String lightStyle(String content) {
        return "\033[32;1m" + content + "\033[0m";
    }

    public String softStyle(String content) {
        return "\033[36;1m" + content + "\033[0m";
    }

    public String warnStyle(String content) {
        return "\033[33;1m" + content + "\033[0m";
    }

    public String errorStyle(String content) {
        return "\033[31;1m" + content + "\033[0m";
    }

    public static void main(String[] args) {
        new FastLog().info(FastLog.class, "测试消息!");
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy