| java.lang.Object org.gjt.sp.util.Log
Log | public class Log (Code) | | This class provides methods for logging events. In terms of functionality,
it is somewhere in between System.out.println() and
full-blown logging packages such as log4j.
All events are logged to an in-memory buffer and optionally a stream,
and those with a high urgency (warnings and errors) are also printed
to standard output.
Logging of exception tracebacks is supported.
This class can also optionally redirect standard output and error to the log.
author: Slava Pestov version: $Id: Log.java 9135 2007-03-13 08:01:11Z Vampire0 $ |
Inner Class :static class LogListModel implements ListModel | |
Field Summary | |
final public static int | DEBUG Debugging message urgency. | final public static int | ERROR Error urgency. | final public static int | MAXLINES The maximum number of log messages that will be kept in memory. | final public static int | MESSAGE Message urgency. | final public static int | NOTICE Notice urgency. | final public static int | WARNING Warning urgency. |
Method Summary | |
public static void | closeStream() Closes the log stream. | public static void | flushStream() Flushes the log stream. | public static ListModel | getLogListModel() Returns the list model for viewing the log contents. | public static void | init(boolean stdio, int level) Initializes the log. | public static void | log(int urgency, Object source, Object message, Throwable exception) Logs an exception with a message. | public static void | log(int urgency, Object source, Object message) Logs a message. | public static void | setLogWriter(Writer stream) Writes all currently logged messages to this stream if there was no
stream set previously, and sets the stream to write future log
messages to. |
DEBUG | final public static int DEBUG(Code) | | Debugging message urgency. Should be used for messages only
useful when debugging a problem.
since: jEdit 2.2pre2 |
ERROR | final public static int ERROR(Code) | | Error urgency. Should be used for messages that signal a
failure.
since: jEdit 2.2pre2 |
MAXLINES | final public static int MAXLINES(Code) | | The maximum number of log messages that will be kept in memory.
since: jEdit 2.6pre5 |
MESSAGE | final public static int MESSAGE(Code) | | Message urgency. Should be used for messages which give more
detail than notices.
since: jEdit 2.2pre2 |
NOTICE | final public static int NOTICE(Code) | | Notice urgency. Should be used for messages that directly
affect the user.
since: jEdit 2.2pre2 |
WARNING | final public static int WARNING(Code) | | Warning urgency. Should be used for messages that warrant
attention.
since: jEdit 2.2pre2 |
closeStream | public static void closeStream()(Code) | | Closes the log stream. Should be done before your program exits.
since: jEdit 2.6pre5 |
flushStream | public static void flushStream()(Code) | | Flushes the log stream.
since: jEdit 2.6pre5 |
getLogListModel | public static ListModel getLogListModel()(Code) | | Returns the list model for viewing the log contents.
since: jEdit 4.2pre1 |
init | public static void init(boolean stdio, int level)(Code) | | Initializes the log.
Parameters: stdio - If true, standard output and error will besent to the log Parameters: level - Messages with this log level or higher willbe printed to the system console since: jEdit 3.2pre4 |
log | public static void log(int urgency, Object source, Object message, Throwable exception)(Code) | | Logs an exception with a message.
If an exception is the cause of a call to
Log.log , then
the exception should be explicitly provided so that it can
be presented to the (debugging) user in a useful manner
(not just the exception message, but also the exception stack trace)
since: jEdit 4.3pre5 |
log | public static void log(int urgency, Object source, Object message)(Code) | | Logs a message. This method is thread-safe.
The following code sends a typical debugging message to the activity
log:
Log.log(Log.DEBUG,this,"counter = " + counter);
The corresponding activity log entry might read as follows:
[debug] JavaParser: counter = 15
Parameters: urgency - The urgency; can be one ofLog.DEBUG , Log.MESSAGE ,Log.NOTICE , Log.WARNING , orLog.ERROR . Parameters: source - The source of the message, either an object or aclass instance. When writing log messages from macros, setthis parameter to BeanShell.class to make macroerrors easier to spot in the activity log. Parameters: message - The message. This can either be a string oran exception since: jEdit 2.2pre2 |
setLogWriter | public static void setLogWriter(Writer stream)(Code) | | Writes all currently logged messages to this stream if there was no
stream set previously, and sets the stream to write future log
messages to.
Parameters: stream - The writer since: jEdit 3.2pre4 |
|
|