コード例 #1
0
ファイル: LoggingUtils.java プロジェクト: pdewan/SelfOptSys
 public String format(LogRecord record) {
   Calendar c = Calendar.getInstance();
   c.setTimeInMillis(record.getMillis());
   String message =
       "["
           + c.getTime().toString()
           + "]"
           + " "
           + record.getLevel()
           + ":"
           + " "
           + record.getMessage()
           + "\n";
   return message;
 }
コード例 #2
0
ファイル: OCSSWRuntimeConfig.java プロジェクト: mg1989/seadas
 @Override
 public String format(LogRecord record) {
   StringWriter sw = new StringWriter();
   PrintWriter pw = new PrintWriter(sw);
   pw.append('[');
   pw.append(record.getLevel().toString());
   pw.append(']');
   pw.append(' ');
   pw.append(LOG_TIME_STAMP_FORMAT.format(new Date(record.getMillis())));
   pw.append(' ');
   pw.append('-');
   pw.append(' ');
   pw.append(record.getMessage());
   Throwable thrown = record.getThrown();
   if (thrown != null) {
     pw.println();
     thrown.printStackTrace(pw);
   }
   pw.println();
   return sw.toString();
 }
コード例 #3
0
ファイル: ConsoleManager.java プロジェクト: BungMc/Bung
    @Override
    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
    public String format(LogRecord record) {
      StringBuilder builder = new StringBuilder();

      builder.append(date.format(record.getMillis()));
      builder.append(" [");
      builder.append(record.getLevel().getLocalizedName().toUpperCase());
      builder.append("] ");
      if (color) {
        builder.append(colorize(formatMessage(record)));
      } else {
        builder.append(formatMessage(record));
      }
      builder.append('\n');

      if (record.getThrown() != null) {
        StringWriter writer = new StringWriter();
        record.getThrown().printStackTrace(new PrintWriter(writer));
        builder.append(writer.toString());
      }

      return builder.toString();
    }