Java Error Print printError(Object obj, String message)

Here you can find the source of printError(Object obj, String message)

Description

Utility for print an error message

License

Apache License

Parameter

Parameter Description
obj For including a place where an error occurred
message An error message

Declaration

public static void printError(Object obj, String message) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//www  . j ava  2 s. com
     * Utility for print an error message
     * @param obj For including a place where an error occurred
     * @param message An error message
     */
    public static void printError(Object obj, String message) {
        System.err.println(obj.getClass().getName() + ": " + message);
    }

    /**
     * Utility for print an error message with a debugging clue
     * @param obj For including a place where an error occurred
     * @param message An error message
     * @param value A debugging clue
     */
    public static void printError(Object obj, String message, String value) {
        if (150 < value.length()) {
            value = value.substring(0, 150);
        }
        System.err.println(obj.getClass().getName() + ": " + message + ", value is \"" + value + "\"");
    }
}

Related

  1. printError(Class c, String m, Exception e)
  2. printError(String error)
  3. printError(String message)
  4. printError(String message, Exception e, boolean pst)
  5. printError(String msg)