All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.io.Log
java.lang.Object
   |
   +----edu.utah.janos.io.Log

  Summary

public class  Log
     extends java.lang.Object
{
          // Fields 16
     public static final int ALERT;
     public static final int CRIT;
     public static final int DBG;
     public static final int EMERG;
     public static final int ERR;
     public static final int INFO;
     public static final int NOTICE;
     private static final int RING_SIZE;
     public static final int WARNING;
     private ByteArrayOutputStream byteStream;
     private PrintWriter byteWriter;
     private Vector listeners;
     private Log.Message[] msg_ring;
     private String prefix;
     private int ring_head;
     private int ring_tail;

          // Constructors 1
     public Log(String);

          // Methods 5
     public void addListener(LogListener);
     public void logMsg(int, String);
     public void logThrowable(Throwable);
     public void removeListener(LogListener);
     public void setPrefix(String);

          // Inner Classes 1
     private class Log.Message
}

A Janos Log interface. A log maintains a buffer of a fixed number of messages. All messages passed to the log via logMsg() are sent to all listeners on the log.

Really just a glorified ring buffer.

Patterned after syslog(3).




  Fields

· EMERG

Summary  |  Top

   public static final int EMERG

System is unusable.


· ALERT

Summary  |  Top
   public static final int ALERT

Action must be taken immediately.


· CRIT

Summary  |  Top
   public static final int CRIT

Critical conditions.


· ERR

Summary  |  Top
   public static final int ERR

Error conditions.


· WARNING

Summary  |  Top
   public static final int WARNING

Warning conditions.


· NOTICE

Summary  |  Top
   public static final int NOTICE

Normal but significant condition.


· INFO

Summary  |  Top
   public static final int INFO

Informational messages.


· DBG

Summary  |  Top
   public static final int DBG

Debug-level messages.


· msg_ring

Summary  |  Top
   private Log.Message[] msg_ring

The ring buffer. The msg_ring is never empty.


· RING_SIZE

Summary  |  Top
   private static final int RING_SIZE

Size of the ring buffer.


· ring_head

Summary  |  Top
   private int ring_head


· ring_tail

Summary  |  Top
   private int ring_tail


· listeners

Summary  |  Top
   private Vector listeners

Listeners on this log. Should be Vector.


· prefix

Summary  |  Top
   private String prefix

Stores the prefix for the log messages


· byteStream

Summary  |  Top
   private ByteArrayOutputStream byteStream


· byteWriter

Summary  |  Top
   private PrintWriter byteWriter


  Constructors

· Log

Summary  |  Top

   public Log(String prefix) 

Create a log. All messages sent to this log will be prefixed with the given prefix string.



  Methods

· setPrefix

Summary  |  Top
   public void setPrefix(String prefix) 

Set the prefix message.



· logMsg

Summary  |  Top
   public void logMsg(int level, 
                      String msg) 

Add a message to this log. Added to the ring buffer. All active listeners will recieve the message, too.



· logThrowable

Summary  |  Top
   public void logThrowable(Throwable th) 

Add a message to the log thats a stack trace



· addListener

Summary  |  Top
   public void addListener(LogListener ll) 

Add a listener to this log. The listener will immediately receive all buffered messages and eventually receive all future messages.



· removeListener

Summary  |  Top
   public void removeListener(LogListener ll) 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7