You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.




org.mozilla.util
Class Log

java.lang.Object
  |
  +--org.mozilla.util.Log

public class Log
extends java.lang.Object

Log


Constructor Summary
Log()
           
 
Method Summary
protected static java.lang.Object applicationNameWithTimeStamp()
           
static void enableTimestampPrefix(boolean enable)
          Incrememnts or decrements whether or not to prefix logged messages with a timestamp.
static java.lang.String getApplicationName()
          Returns the applicationName set by "setApplicationName()"
static java.lang.String getApplicationVersion()
          Returns the applicationVersion set by "setApplicationVersion()"
static java.lang.String getApplicationVersionDate()
          Returns the applicationVersion set by "setApplicationVersionDate()"
static void log(java.lang.Object infoMessage)
          Writes "infoMessage" to stdout, prefixed by the string "ApplicationName: "
static void logDebugMessage(java.lang.Object debugMessage)
          Equivalent to calling "logDebugMessage(debugMessage, "ALL")".
static void logDebugMessage(java.lang.Object debugMessage, boolean aCondition)
          Log a message when "aCondition" is true, otherwise be silent.
static void logDebugMessage(java.lang.Object anInstance, java.lang.Object debugMessage)
          Equivalent to calling "logDebugMessage(anInstance, debugMessage, "ALL")".
static void logDebugMessage(java.lang.Object anInstance, java.lang.Object debugMessage, boolean aCondition)
          Log a message when "aCondition" is true, otherwise be silent.
static void logDebugMessage(java.lang.Object anInstance, java.lang.Object debugMessage, java.lang.String debugFilter)
          Writes "debugMessage" to stderr, prefixed by the string "ApplicationName: ClassName[0xhashCode]: " *
static void logDebugMessage(java.lang.Object debugMessage, java.lang.String debugFilter)
          Funnel-point method for printing debug messages.
static void logError(java.lang.Object errorMessage)
          Writes "errorMessage" to stderr, prefixed by the string "ApplicationName error: "
static void logErrorMessage(java.lang.Object errorMessage)
          Writes "errorMessage" to stderr, prefixed by the string "ApplicationName: "
static void setApplicationName(java.lang.String newApplicationName)
          This string will be prepended to all output from this class.
static void setApplicationVersion(java.lang.String newApplicationVersion)
           
static void setApplicationVersionDate(java.lang.String newApplicationVersionDate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log

public Log()
Method Detail

setApplicationName

public static void setApplicationName(java.lang.String newApplicationName)
This string will be prepended to all output from this class. This string is usually the application name, e.g. "JavaPlan". It is useful because it includes a timestamp and the base string (usually the application name), so that if two apps are launched from the same commandline (for example), with "&", or one app invokes another, it is clear who the message is comming from. The time stamp can help see how long operations took, etc. If you don't want your messages prefixed with anything (no time stamp or name), you must pass "null" for "applicationName". If this method is never called, "applicationName" will default to: "APPLICATION NAME UNKNOWN [call setApplicationName from main]"

getApplicationName

public static java.lang.String getApplicationName()
Returns the applicationName set by "setApplicationName()"

setApplicationVersion

public static void setApplicationVersion(java.lang.String newApplicationVersion)

getApplicationVersion

public static java.lang.String getApplicationVersion()
Returns the applicationVersion set by "setApplicationVersion()"

setApplicationVersionDate

public static void setApplicationVersionDate(java.lang.String newApplicationVersionDate)

getApplicationVersionDate

public static java.lang.String getApplicationVersionDate()
Returns the applicationVersion set by "setApplicationVersionDate()"

applicationNameWithTimeStamp

protected static java.lang.Object applicationNameWithTimeStamp()

enableTimestampPrefix

public static void enableTimestampPrefix(boolean enable)
Incrememnts or decrements whether or not to prefix logged messages with a timestamp. Two (or "n") calls with a value of "false" must be followed by two (or "n") calls with a value of "true" to reenable timestamp prefixes.

log

public static void log(java.lang.Object infoMessage)
Writes "infoMessage" to stdout, prefixed by the string "ApplicationName: "

logError

public static void logError(java.lang.Object errorMessage)
Writes "errorMessage" to stderr, prefixed by the string "ApplicationName error: "

logErrorMessage

public static void logErrorMessage(java.lang.Object errorMessage)
Writes "errorMessage" to stderr, prefixed by the string "ApplicationName: "

logDebugMessage

public static void logDebugMessage(java.lang.Object debugMessage,
                                   java.lang.String debugFilter)
Funnel-point method for printing debug messages. Writes "debugMessage" to stderr, prefixed by the string "ApplicationName:" This method only works if the debugFilter string is found in Debug's list of filter strings (which you can normally set on the commandline, see JDApplication), or if the "ALL" filter has been set into Debug's list of filters, or if the passed in filter is "", which is considered to always be "set", and will print a line with "[DEBUG]" listed as the filter. This method may be called with a "null" debugMessage. A debugMessage is sometimes unneccesary since the matched filter string is printed with the output anyway, and that is frequently enough information.

logDebugMessage

public static void logDebugMessage(java.lang.Object debugMessage)
Equivalent to calling "logDebugMessage(debugMessage, "ALL")".

logDebugMessage

public static void logDebugMessage(java.lang.Object debugMessage,
                                   boolean aCondition)
Log a message when "aCondition" is true, otherwise be silent. Equivalent to calling "if (aCondition) logDebugMessage(debugMessage, "")".

logDebugMessage

public static void logDebugMessage(java.lang.Object anInstance,
                                   java.lang.Object debugMessage,
                                   boolean aCondition)
Log a message when "aCondition" is true, otherwise be silent.

logDebugMessage

public static void logDebugMessage(java.lang.Object anInstance,
                                   java.lang.Object debugMessage)
Equivalent to calling "logDebugMessage(anInstance, debugMessage, "ALL")".

logDebugMessage

public static void logDebugMessage(java.lang.Object anInstance,
                                   java.lang.Object debugMessage,
                                   java.lang.String debugFilter)
Writes "debugMessage" to stderr, prefixed by the string "ApplicationName: ClassName[0xhashCode]: " *