Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.lutris.logging
Class StandardLogChannel  view StandardLogChannel download StandardLogChannel.java

java.lang.Object
  extended bycom.lutris.logging.StandardLogChannel
All Implemented Interfaces:
LogChannel

public class StandardLogChannel
extends java.lang.Object
implements LogChannel

Standard implementation of a channel associated with a logging facility. All messages for the facility are written using a channel. Care is take to avoid synchronization when possible for performance reasons.


Field Summary
private static java.text.SimpleDateFormat dateFormatter
          Format for the date.
private  java.lang.String facility
          Our symbolic name.
private  StandardLogger logger
          Logger object with which we are associated.
 
Constructor Summary
protected StandardLogChannel(java.lang.String chanFacility, StandardLogger loggerObj)
          Construct a new log channel.
 
Method Summary
private  void doWrite(java.io.PrintWriter out, java.util.Date date, int level, java.lang.String msg)
          Do the work of writting a log message.
 int getLevel(java.lang.String level)
          Convert a symbolic level to an integer identifier.
 LogWriter getLogWriter(int level)
          Create a LogWrite associated with a particular level.
 LogWriter getLogWriter(java.lang.String level)
          Create a LogWrite associated with a particular level.
 boolean isEnabled(int level)
          Determine if logging is enabled for the specified level.
 boolean isEnabled(java.lang.String level)
          Determine if logging is enabled for the specified level.
 void write(int level, java.lang.String msg)
          Write a string to the log file.
 void write(int level, java.lang.String msg, java.lang.Throwable throwable)
          Write a string and exception to the log file.
 void write(java.lang.String level, java.lang.String msg)
          Write a string to the log file.
 void write(java.lang.String level, java.lang.String msg, java.lang.Throwable throwable)
          Write a string and exception to the log file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

facility

private java.lang.String facility
Our symbolic name.


dateFormatter

private static final java.text.SimpleDateFormat dateFormatter
Format for the date.


logger

private StandardLogger logger
Logger object with which we are associated.

Constructor Detail

StandardLogChannel

protected StandardLogChannel(java.lang.String chanFacility,
                             StandardLogger loggerObj)
Construct a new log channel.

Method Detail

getLevel

public int getLevel(java.lang.String level)
Description copied from interface: LogChannel
Convert a symbolic level to an integer identifier.

Specified by:
getLevel in interface LogChannel

getLogWriter

public LogWriter getLogWriter(java.lang.String level)
Description copied from interface: LogChannel
Create a LogWrite associated with a particular level. This is often an easier object to use than a LogChannel if limited levels are needed.

Specified by:
getLogWriter in interface LogChannel

getLogWriter

public LogWriter getLogWriter(int level)
Description copied from interface: LogChannel
Create a LogWrite associated with a particular level. This is often an easier object to use than a LogChannel if limited levels are needed.

Specified by:
getLogWriter in interface LogChannel

isEnabled

public boolean isEnabled(int level)
Description copied from interface: LogChannel
Determine if logging is enabled for the specified level. This is useful to prevent a series of unnecessary logging calls, as often encountered with debug logging, or a call where generating the message is expensive.

Specified by:
isEnabled in interface LogChannel

isEnabled

public boolean isEnabled(java.lang.String level)
Description copied from interface: LogChannel
Determine if logging is enabled for the specified level. This is useful to prevent a series of unnecessary logging calls, as often encountered with debug logging, or a call where generating the message is expensive.

Specified by:
isEnabled in interface LogChannel

doWrite

private void doWrite(java.io.PrintWriter out,
                     java.util.Date date,
                     int level,
                     java.lang.String msg)
Do the work of writting a log message. It should already be determined if the channel is enabled; but limited synchronization is required, as we ignore any error while writing. Handles multiline messages.


write

public void write(int level,
                  java.lang.String msg)
Description copied from interface: LogChannel
Write a string to the log file.

Specified by:
write in interface LogChannel

write

public void write(java.lang.String level,
                  java.lang.String msg)
Description copied from interface: LogChannel
Write a string to the log file.

Specified by:
write in interface LogChannel

write

public void write(int level,
                  java.lang.String msg,
                  java.lang.Throwable throwable)
Description copied from interface: LogChannel
Write a string and exception to the log file.

Specified by:
write in interface LogChannel

write

public void write(java.lang.String level,
                  java.lang.String msg,
                  java.lang.Throwable throwable)
Description copied from interface: LogChannel
Write a string and exception to the log file.

Specified by:
write in interface LogChannel