Perforce

com.perforce.api
Class EventLog

java.lang.Object
  |
  +--com.perforce.api.EventLog

public class EventLog
extends Object

This class controls an event log. A set number of log entries are kept in memory, but all log entries are sent to a log file.

Version:
$Date: 2003/09/05 $ $Revision: #1 $
Author:
David Markley

Constructor Summary
EventLog()
          Default, no-argument constructor.
EventLog(String title)
          Constructor that accepts the title for this.
EventLog(String title, String filename)
          Constructor that sets the log title and ouput filename.
 
Method Summary
static void commonLog(String event)
          Logs an event to the common log.
static void commonLog(String event, String level)
          Logs an event to the common log.
static void commonLog(String event, String level, boolean encode)
          Logs an event to the common log.
 String getFileName()
          Returns the output file name.
 Enumeration getLog()
          Returns an Enumeration that contains all the events in the log.
 int getSize()
          Returns the size of the event log memory.
 String getTitle()
          Gets the title of the log.
 void log(String event)
          Logs an event to this log.
 void log(String event, String level)
          Logs an event to this log.
 void log(String event, String level, boolean encode)
          Logs an event to this log.
static void printLog(EventLog elog, PrintWriter out, String format)
          Prints a log, using the specified format.
static void printLog(PrintWriter out, String format)
          Prints this log, using the specified format.
 void setSize(int size)
          Sets the size of the log.
 void setTitle(String title)
          Sets the title for this log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventLog

public EventLog()
Default, no-argument constructor. This initialized the Vector of events and the date and time format.
See Also:
Vector

EventLog

public EventLog(String title)
Constructor that accepts the title for this. The title is used when the webSend() method is invoked.
Parameters:
title - The title for this log.

EventLog

public EventLog(String title,
                String filename)
Constructor that sets the log title and ouput filename.
Parameters:
title - The title for this log.
filename - Name for the output file.
Method Detail

commonLog

public static void commonLog(String event)
Logs an event to the common log. The event passed in is added to the log. If the log is beyond its maximum size, then the oldest events are dropped.
Parameters:
event - The event to be logged.

commonLog

public static void commonLog(String event,
                             String level)
Logs an event to the common log. The event passed in is added to the log. If the log is beyond its maximum size, then the oldest events are dropped.
Parameters:
event - The event to be logged.
level - Level for the logged event.

commonLog

public static void commonLog(String event,
                             String level,
                             boolean encode)
Logs an event to the common log. The event passed in is added to the log. If the log is beyond its maximum size, then the oldest events are dropped.
Parameters:
event - The event to be logged.
level - Level for the logged event.
encode - Indicates that the output should be XML/HTML encoded.

getFileName

public String getFileName()
Returns the output file name.

getLog

public Enumeration getLog()
Returns an Enumeration that contains all the events in the log.
Returns:
List of Strings in the log.

getSize

public int getSize()
Returns the size of the event log memory. This is the maximum number of lines that will be maintained in memory.

getTitle

public String getTitle()
Gets the title of the log.

log

public void log(String event)
Logs an event to this log. The event passed in is added to the log. If the log is beyond its maximum size, then the oldest events are dropped.
Parameters:
event - The event to be logged.

log

public void log(String event,
                String level)
Logs an event to this log. The event passed in is added to the log. If the log is beyond its maximum size, then the oldest events are dropped.
Parameters:
event - The event to be logged.
level - Level for the logged event.

log

public void log(String event,
                String level,
                boolean encode)
Logs an event to this log. The event passed in is added to the log. If the log is beyond its maximum size, then the oldest events are dropped.
Parameters:
event - The event to be logged.
level - Level for the logged event.
encode - Indicates that the output should be XML/HTML encoded.

printLog

public static void printLog(EventLog elog,
                            PrintWriter out,
                            String format)
Prints a log, using the specified format. Each line is placed in the format string where {0} occurs.
Parameters:
elog - EventLog to print.
out - Print output.
format - Format to use.
See Also:
java.text.MessageFormat

printLog

public static void printLog(PrintWriter out,
                            String format)
Prints this log, using the specified format. Each line is placed in the format string where {0} occurs.
Parameters:
out - Print output.
format - Format to use.
See Also:
java.text.MessageFormat

setSize

public void setSize(int size)
Sets the size of the log. This is the maximum number of lines that the log will maintain in memory.
Parameters:
size - The number of lines to keep in the log.

setTitle

public void setTitle(String title)
Sets the title for this log.
Parameters:
title - The title of the log.

Perforce

Copyright © 2001, Perforce Software, All rights reserved.