// Path: src/main/java/ws/nmathe/saber/Main.java
// public class Main
// {
//     private static ShardManager shardManager;
//     private static BotSettingsManager botSettingsManager     = new BotSettingsManager();
//     private static EntryManager entryManager                 = new EntryManager();
//     private static ScheduleManager scheduleManager           = new ScheduleManager();
//     private static CommandHandler commandHandler             = new CommandHandler();
//     private static CalendarConverter calendarConverter       = new CalendarConverter();
//     private static GuildSettingsManager guildSettingsManager = new GuildSettingsManager();
//     private static Driver mongoDriver                        = new Driver();
// 
//     /**
//      * initialize the bot
//      */
//     public static void main(String[] args)
//     {
//         if(botSettingsManager.hasSettings())
//         {
//             Logging.info(Main.class, "A 'saber.toml' configuration file has been created. Add your " +
//                     "bot token to the file and restart the bot.\n");
//             System.exit(0);
//         }
// 
//         mongoDriver.init();         // ready database
//         calendarConverter.init();   // connect to calendar service
// 
//         // create the shard manager
//         shardManager = new ShardManager(botSettingsManager.getShards(), botSettingsManager.getShardTotal());
//     }
// 
//     /*
//      * Getters for manager type objects
//      */
// 
//     public static ShardManager getShardManager()
//     {
//         return shardManager;
//     }
// 
//     public static BotSettingsManager getBotSettingsManager()
//     {
//         return botSettingsManager;
//     }
// 
//     public static CommandHandler getCommandHandler()
//     {
//         return commandHandler;
//     }
// 
//     public static EntryManager getEntryManager()
//     {
//         return entryManager;
//     }
// 
//     public static ScheduleManager getScheduleManager()
//     {
//        return scheduleManager;
//     }
// 
//     public static GuildSettingsManager getGuildSettingsManager()
//     {
//         return guildSettingsManager;
//     }
// 
//     public static CalendarConverter getCalendarConverter()
//     {
//         return calendarConverter;
//     }
// 
//     public static Driver getDBDriver()
//     {
//         return mongoDriver;
//     }
// }


import ws.nmathe.saber.Main;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
    {
        if(Main.getBotSettingsManager().getLogLevel() < 2) return;

        String now = LocalTime.now().truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_TIME);
        String content = "[" + now + "] " +
                ANSI_RED + "[Warn]" + ANSI_RESET + " " +
                ANSI_YELLOW_BACKGROUND + ANSI_BLACK +
                "[" + caller.getSimpleName() + "]" +
                ANSI_RESET + " " + ANSI_RED + msg +
                ANSI_RESET;

        System.out.println(content);
    }

    /**
     * used for logging significant (unexpected) errors (level 1)
     * @param caller the java class from which the command is called
     * @param error the error
     */
    public static void exception(Class caller, Throwable error)
    {
        if(Main.getBotSettingsManager().getLogLevel() < 1) return;

        String now = LocalTime.now().truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_TIME);
        String content = "[" + now + "] " +
                ANSI_PURPLE + "[Excp]" + ANSI_RESET + " " +
                ANSI_PURPLE_BACKGROUND + ANSI_BLACK +
                "[" + caller.getSimpleName() + "]" +
                ANSI_RESET + " " + ANSI_PURPLE + error.getMessage() +
                ANSI_RESET;
// Path: src/main/java/ws/nmathe/saber/Main.java
// public class Main
// {
//     private static ShardManager shardManager;
//     private static BotSettingsManager botSettingsManager     = new BotSettingsManager();
//     private static EntryManager entryManager                 = new EntryManager();
//     private static ScheduleManager scheduleManager           = new ScheduleManager();
//     private static CommandHandler commandHandler             = new CommandHandler();
//     private static CalendarConverter calendarConverter       = new CalendarConverter();
//     private static GuildSettingsManager guildSettingsManager = new GuildSettingsManager();
//     private static Driver mongoDriver                        = new Driver();
// 
//     /**
//      * initialize the bot
//      */
//     public static void main(String[] args)
//     {
//         if(botSettingsManager.hasSettings())
//         {
//             Logging.info(Main.class, "A 'saber.toml' configuration file has been created. Add your " +
//                     "bot token to the file and restart the bot.\n");
//             System.exit(0);
//         }
// 
//         mongoDriver.init();         // ready database
//         calendarConverter.init();   // connect to calendar service
// 
//         // create the shard manager
//         shardManager = new ShardManager(botSettingsManager.getShards(), botSettingsManager.getShardTotal());
//     }
// 
//     /*
//      * Getters for manager type objects
//      */
// 
//     public static ShardManager getShardManager()
//     {
//         return shardManager;
//     }
// 
//     public static BotSettingsManager getBotSettingsManager()
//     {
//         return botSettingsManager;
//     }
// 
//     public static CommandHandler getCommandHandler()
//     {
//         return commandHandler;
//     }
// 
//     public static EntryManager getEntryManager()
//     {
//         return entryManager;
//     }
// 
//     public static ScheduleManager getScheduleManager()
//     {
//        return scheduleManager;
//     }
// 
//     public static GuildSettingsManager getGuildSettingsManager()
//     {
//         return guildSettingsManager;
//     }
// 
//     public static CalendarConverter getCalendarConverter()
//     {
//         return calendarConverter;
//     }
// 
//     public static Driver getDBDriver()
//     {
//         return mongoDriver;
//     }
// }


// Path: src/main/java/ws/nmathe/saber/utils/Logging.java
import ws.nmathe.saber.Main;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

    {
        if(Main.getBotSettingsManager().getLogLevel() < 2) return;

        String now = LocalTime.now().truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_TIME);
        String content = "[" + now + "] " +
                ANSI_RED + "[Warn]" + ANSI_RESET + " " +
                ANSI_YELLOW_BACKGROUND + ANSI_BLACK +
                "[" + caller.getSimpleName() + "]" +
                ANSI_RESET + " " + ANSI_RED + msg +
                ANSI_RESET;

        System.out.println(content);
    }

    /**
     * used for logging significant (unexpected) errors (level 1)
     * @param caller the java class from which the command is called
     * @param error the error
     */
    public static void exception(Class caller, Throwable error)
    {
        if(Main.getBotSettingsManager().getLogLevel() < 1) return;

        String now = LocalTime.now().truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_TIME);
        String content = "[" + now + "] " +
                ANSI_PURPLE + "[Excp]" + ANSI_RESET + " " +
                ANSI_PURPLE_BACKGROUND + ANSI_BLACK +
                "[" + caller.getSimpleName() + "]" +
                ANSI_RESET + " " + ANSI_PURPLE + error.getMessage() +
                ANSI_RESET;
        System.out.println(content);