Repository
Class Log

java.lang.Object
  extended byRepository.Log

public class Log
extends java.lang.Object

Logging class.

alexis.grandemange@pagebox.net

Copyright (c) 2002-2004 Alexis Grandemange

This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation; version 2.1 of the
 License.
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU Lesser General Public License for more details.
 A copy of the GNU Lesser General Public License lesser.txt should be
 included in the distribution.

Version:
0, 0, 1
Author:
Alexis Grandemange

Field Summary
(package private)  java.io.PrintWriter log
          Log file
private  java.lang.String logFile
          Path of the log file
private static java.util.HashMap logs
          Log map Key: path of the log file Value: Log object
(package private)  boolean mode
          True if information messages
private  java.text.SimpleDateFormat sdf
          SimpleDateFormat used to build log entries
 
Constructor Summary
private Log(java.lang.String logFile, boolean mode)
          Constructor.
 
Method Summary
(package private)  void erase()
          Clear the trace
 void error(java.lang.String requestor, java.lang.String host, java.lang.String msg)
          Log an error message
(package private) static Log getLog(java.lang.String logFile, boolean mode)
          Return a Log object from logs.
(package private)  boolean getMode()
          Get the tracing mode
(package private)  java.io.BufferedReader getReader()
          Get a Reader on the log file.
 void info(java.lang.String requestor, java.lang.String host, java.lang.String msg)
          Log an information message
(package private)  void setMode(boolean mode)
          Set the tracing mode
(package private)  void warn(java.lang.String requestor, java.lang.String host, java.lang.String msg)
          Log a warning message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sdf

private final java.text.SimpleDateFormat sdf
SimpleDateFormat used to build log entries


mode

boolean mode
True if information messages


log

java.io.PrintWriter log
Log file


logFile

private java.lang.String logFile
Path of the log file


logs

private static java.util.HashMap logs
Log map

Constructor Detail

Log

private Log(java.lang.String logFile,
            boolean mode)
Constructor. Open the log file.

Parameters:
logFile - path of the log file
mode - true if information messages
Method Detail

getLog

static Log getLog(java.lang.String logFile,
                  boolean mode)
Return a Log object from logs.

Returns:
Log object

getReader

java.io.BufferedReader getReader()
Get a Reader on the log file.

Returns:
reader on the log file

setMode

final void setMode(boolean mode)
Set the tracing mode

Parameters:
mode - true if information messages

getMode

final boolean getMode()
Get the tracing mode

Returns:
true if information messages

erase

void erase()
Clear the trace


info

public final void info(java.lang.String requestor,
                       java.lang.String host,
                       java.lang.String msg)
Log an information message

Parameters:
requestor - user who requested the action
host - user host
msg - message

warn

final void warn(java.lang.String requestor,
                java.lang.String host,
                java.lang.String msg)
Log a warning message

Parameters:
requestor - user who requested the action
host - user host
msg - message

error

public final void error(java.lang.String requestor,
                        java.lang.String host,
                        java.lang.String msg)
Log an error message

Parameters:
requestor - user who requested the action
host - user host
msg - message