package com.yutou.qqbot.utlis;

public class Log {
    public static void i(String tag, Object log) {
        i('[' + tag + ']' + log);
    }

    public static void i(Object log) {
        if (ConfigTools.load(ConfigTools.CONFIG, "logout", boolean.class, false)) {
            System.out.printf("[%s]%s%n",
                    AppTools.getToDayNowTimeToString(),
                    log
            );
        }

    }

    public static void e(String tag, Exception e) {
        System.err.printf("[%s]%s - %s%n",
                AppTools.getToDayNowTimeToString(),
                tag,
                AppTools.getExceptionString(e)
        );
    }

    public static void i(Object tag, Object log) {
        if (tag instanceof String) {
            i("[" + tag + "]" + log);
        } else {
            i(tag.getClass().getSimpleName(), log);
        }
    }
}
