Пример #1
0
 public void save(String... args) {
   String time = Util.getTime();
   String arg = Util.bindArray(args);
   if (Calendar.getInstance().get(Calendar.DATE) != dayNumber) {
     file =
         new File(
             Main.getLogFolderName()
                 + File.separator
                 + plugin.getPluginName()
                 + File.separator
                 + (folderName.isEmpty() ? "" : (folderName + File.separator))
                 + new StringBuilder()
                     .append(Calendar.getInstance().get(Calendar.YEAR))
                     .append(".")
                     .append(Calendar.getInstance().get(Calendar.MONTH) + 1)
                     .append(".")
                     .append(Calendar.getInstance().get(Calendar.DATE))
                     .append(":")
                     .append(Calendar.getInstance().get(Calendar.HOUR_OF_DAY))
                     .append(".")
                     .append(Calendar.getInstance().get(Calendar.MINUTE))
                     .append(".")
                     .append(Calendar.getInstance().get(Calendar.SECOND))
                 + ".log");
   }
   fileWrite(time + "| " + arg);
 }
Пример #2
0
 @SuppressWarnings("deprecation")
 public SpecialLogger(MetaPlugin plugin, String folderName) {
   this.plugin = plugin;
   this.folderName = folderName;
   dayNumber = Calendar.getInstance().get(Calendar.DATE);
   file =
       new File(
           Main.getLogFolderName()
               + File.separator
               + plugin.getPluginName()
               + File.separator
               + (folderName.isEmpty() ? "" : (folderName + File.separator))
               + new StringBuilder()
                   .append(Calendar.getInstance().get(Calendar.YEAR))
                   .append(".")
                   .append(Calendar.getInstance().get(Calendar.MONTH) + 1)
                   .append(".")
                   .append(Calendar.getInstance().get(Calendar.DATE))
                   .append(":")
                   .append(Calendar.getInstance().get(Calendar.HOUR_OF_DAY))
                   .append(".")
                   .append(Calendar.getInstance().get(Calendar.MINUTE))
                   .append(".")
                   .append(Calendar.getInstance().get(Calendar.SECOND))
               + ".log");
   file.getParentFile().mkdirs();
   try {
     file.createNewFile();
   } catch (IOException e) {
     Logger.write("Core", Level.WARN, "Couldn't create Log File!");
   }
 }