log.java

来自「以传奇中的人物和怪物作为角色」· Java 代码 · 共 52 行

JAVA
52
字号
package com.liuwan.log;

/**
 * <p>Title: Develop game research</p>
 *
 * <p>Description: Develop game research</p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: Liuwan studio</p>
 *
 * @author Liuwan
 * @version 1.0
 */
import java.util.Date;
public class Log {
  public Log() {

  }

  /**
   * 捕捉错误,输出错误系统日志
   * @param s 错误描述
   * @param throwable 捕捉到的异常类
   */
  public static void error(String s, Throwable throwable) {
    System.out.println(new Date(System.currentTimeMillis()).toString() + " [ " + s + " ] " + throwable);
  }
  /**
   * 捕捉错误,输出错误系统日志
   * @param throwable
   */
  public static void error(Throwable throwable) {
    System.out.println("Error: "+new Date(System.currentTimeMillis()).toString() + " [ " + throwable +" ]");
  }
  public static void error(String errorMsg) {
    System.out.println("Error: "+new Date(System.currentTimeMillis()).toString() + " [ " + errorMsg + " ]");
  }

  public static void error(String className, String methodName,
                           String errorMsg) {
      System.out.println("Error: " +
                         new Date(System.currentTimeMillis()).toString() +
                         " class: " + className + " methodName: " +
                         methodName + " [ " + errorMsg + " ]");
  }

  public static void message(String msg) {
      System.out.println("Message: " + " [ " + msg + " ]");
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?