tribble.io
Interface LoggerI

All Known Implementing Classes:
Logger

public interface LoggerI

Message logger (logging output stream).

Classes that implement this interface are encouraged (but not required) to have the following constructors:

    class MyLoggerClass
        implements tribble.io.LoggerI
    {
        public MyLoggerClass() {...}
        public MyLoggerClass(java.io.PrintWriter out) {...}
    } 

It is also recommended that implementations synchronize their write operations to their underlying output streams. (See java.io.Writer.lock for further details.)

Since:
2003-01-06
Version:
$Revision: 1.3 $ $Date: 2003/03/08 17:16:44 $
Author:
David R. Tribble, david@tribble.com.
Copyright ©2003 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.
See Also:
Logger

Field Summary
static int PFX__DFL
          Prefixing flag: Default setting.
static int PFX_DATE
          Prefixing flag: Show the current date.
static int PFX_LOC
          Prefixing flag: Show the location name/title.
static int PFX_NONE
          Prefixing flag: None.
static int PFX_TIME
          Prefixing flag: Show the current time.
static java.lang.String REV
          Revision information.
static short SEV_DEBUG
          Severity level: Debug.
static short SEV_ERROR
          Severity level: Error.
static short SEV_FATAL
          Severity level: Fatal (unrecoverable) error.
static short SEV_INFO
          Severity level: Informational.
static short SEV_INTERNAL
          Severity level: Internal (unrecoverable) fatal error.
static short SEV_WARNING
          Severity level: Warning.
 
Method Summary
 void close()
          Close this message logger.
 void debug(int verb, java.lang.String loc, java.lang.String msg)
          Write a formatted debugging message to this message logger.
 void error(java.lang.String loc, java.lang.String msg)
          Write a formatted error message to this message logger.
 void fatal(java.lang.String loc, java.lang.String msg)
          Write a formatted fatal error message to this message logger.
 java.io.PrintWriter getOutput()
          Retrieve the underlying output stream for this message logger.
 void info(int verb, java.lang.String loc, java.lang.String msg)
          Write a formatted informational message to this message logger.
 void log(int sev, int verb, java.lang.String loc, java.lang.String msg)
          Write a formatted message to this message logger.
 void setOutput(java.io.Writer out)
          Establish the underlying output stream for this message logger.
 int setPrefix(int pfx)
          Establish the prefixes to be prepended to messages written to this message logger.
 int setVerbosity(int sev, int max)
          Establish the verbosity filtering level for this message logger.
 void warning(int verb, java.lang.String loc, java.lang.String msg)
          Write a formatted warning message to this message logger.
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

SEV_DEBUG

static final short SEV_DEBUG
Severity level: Debug.

See Also:
Constant Field Values

SEV_INFO

static final short SEV_INFO
Severity level: Informational.

See Also:
Constant Field Values

SEV_WARNING

static final short SEV_WARNING
Severity level: Warning.

See Also:
Constant Field Values

SEV_ERROR

static final short SEV_ERROR
Severity level: Error.

See Also:
Constant Field Values

SEV_FATAL

static final short SEV_FATAL
Severity level: Fatal (unrecoverable) error.

See Also:
Constant Field Values

SEV_INTERNAL

static final short SEV_INTERNAL
Severity level: Internal (unrecoverable) fatal error.

See Also:
Constant Field Values

PFX_NONE

static final int PFX_NONE
Prefixing flag: None.

See Also:
Constant Field Values

PFX_DATE

static final int PFX_DATE
Prefixing flag: Show the current date.

See Also:
Constant Field Values

PFX_TIME

static final int PFX_TIME
Prefixing flag: Show the current time.

See Also:
Constant Field Values

PFX_LOC

static final int PFX_LOC
Prefixing flag: Show the location name/title.

See Also:
Constant Field Values

PFX__DFL

static final int PFX__DFL
Prefixing flag: Default setting.

See Also:
Constant Field Values
Method Detail

setOutput

void setOutput(java.io.Writer out)
Establish the underlying output stream for this message logger.

Parameters:
out - A logging output stream.
Since:
1.3, 2003-03-08

getOutput

java.io.PrintWriter getOutput()
Retrieve the underlying output stream for this message logger.

Returns:
The underlying output stream for this logging output stream.
Since:
1.1, 2003-01-06

close

void close()
Close this message logger.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Since:
1.1, 2003-01-06

setPrefix

int setPrefix(int pfx)
Establish the prefixes to be prepended to messages written to this message logger.

Parameters:
pfx - Zero or more of the PFX_XXX prefixing bitflag constants or-ed together.
Returns:
The previous prefix setting.
Since:
1.1, 2003-01-08

setVerbosity

int setVerbosity(int sev,
                 int max)
Establish the verbosity filtering level for this message logger.

Parameters:
sev - The severity of the messages to be filtered. This should be one of the SEV_XXX constants, or zero to specify all message severities.
max - The maximum verbosity filtering level for messages written to this message logger. Log messages with a verbosity level not greater than this value will be written to the logging output stream; those with a verbosity level greater than this value will be ignored.
Returns:
The previous verbosity level setting.
Since:
1.2, 2003-02-16

log

void log(int sev,
         int verb,
         java.lang.String loc,
         java.lang.String msg)
Write a formatted message to this message logger.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Parameters:
sev - The severity of the message, which should be one of the SEV_XXX constants.
verb - The verbosity level of the message. The higher the level, the more verbose the message (i.e., the more frequently the message is logged) and thus the more likely it will be filtered and not written to the output stream; messages with a level of zero will always be written to the output stream.
loc - The name of the location (typically a thread or class name) from where the log message originates. This serves as a label to prefix the message with in the logging output stream. This can be empty ("") or null, in which case no location is written.
msg - A text message to log.
Since:
1.2, 2003-01-16

debug

void debug(int verb,
           java.lang.String loc,
           java.lang.String msg)
Write a formatted debugging message to this message logger. Debugging messages have an implied severity of SEV_DEBUG.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Parameters:
verb - The verbosity level of the message. The higher the level, the more verbose the message (i.e., the more frequently the message is logged) and thus the more likely it will be filtered and not written to the output stream; messages with a level of zero will always be written to the output stream.
loc - The name of the location (typically a thread or class name) from where the log message originates. This serves as a label to prefix the message with in the logging output stream. This can be empty ("") or null, in which case no location is written.
msg - A text message to log.
Since:
1.2, 2003-01-16

info

void info(int verb,
          java.lang.String loc,
          java.lang.String msg)
Write a formatted informational message to this message logger. Informational messages have an implied severity of SEV_INFO.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Parameters:
verb - The verbosity level of the message. The higher the level, the more verbose the message (i.e., the more frequently the message is logged) and thus the more likely it will be filtered and not written to the output stream; messages with a level of zero will always be written to the output stream.
loc - The name of the location (typically a thread or class name) from where the log message originates. This serves as a label to prefix the message with in the logging output stream. This can be empty ("") or null, in which case no location is written.
msg - A text message to log.
Since:
1.2, 2003-01-16

warning

void warning(int verb,
             java.lang.String loc,
             java.lang.String msg)
Write a formatted warning message to this message logger. Warning messages have an implied severity of SEV_WARNING.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Parameters:
verb - The verbosity level of the message. The higher the level, the more verbose the message (i.e., the more frequently the message is logged) and thus the more likely it will be filtered and not written to the output stream; messages with a level of zero will always be written to the output stream.
loc - The name of the location (typically a thread or class name) from where the log message originates. This serves as a label to prefix the message with in the logging output stream. This can be empty ("") or null, in which case no location is written.
msg - A text message to log.
Since:
1.2, 2003-01-16

error

void error(java.lang.String loc,
           java.lang.String msg)
Write a formatted error message to this message logger. Error messages have an implied severity of SEV_ERROR.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Parameters:
loc - The name of the location (typically a thread or class name) from where the log message originates. This serves as a label to prefix the message with in the logging output stream. This can be empty ("") or null, in which case no location is written.
msg - A text message to log.
Since:
1.2, 2003-01-16

fatal

void fatal(java.lang.String loc,
           java.lang.String msg)
Write a formatted fatal error message to this message logger. Fatal error messages have an implied severity of SEV_FATAL.

Note that this method does not throw any checked exceptions, specifically java.io.IOException.

Parameters:
loc - The name of the location (typically a thread or class name) from where the log message originates. This serves as a label to prefix the message with in the logging output stream. This can be empty ("") or null, in which case no location is written.
msg - A text message to log.
Since:
1.2, 2003-01-16