attrib4j
Class Log

java.lang.Object
  |
  +--attrib4j.Log

public class Log
extends java.lang.Object

Simple helper class that allows to send debug messages to the Java console according to the tracing level. Log levels are from standard unix syslog. TODO Switch to levels used in log4j or jdk1.4

Version:
$Id: Log.java,v 1.9 2003/09/01 22:02:42 markpollack Exp $
Author:
Mark Pollack

Field Summary
static int ALERT
          A condition that should be corrected immediately.
static int CRITICAL
          Critical conditions.
static int DEBUG
          Message that contain information normally of use only when debugging a program.
static int EMERGENCY
          A panic condition.
static int ERROR
          Errors.
static int INFO
          Informational messages.
static int LEVEL
          Debug level Note: It has been made public for performance optimization to reduce overhead of including tracing messages
static int NOTICE
          Conditions that are not error conditions, but that may require special handling.
static int WARNING
          Warning messages
 
Constructor Summary
Log()
           
 
Method Summary
static void debug(java.lang.Object o, java.lang.String message)
          Convenience method to pick the debug level using the method name.
static void debug(java.lang.String message)
          Convenience method to pick the debug level using method name.
static void error(java.lang.Object o, java.lang.String message)
          Convenience method to pick the error level using the method nam.e
static int getLevel()
          Return the log level.
static void info(java.lang.Object o, java.lang.String message)
          Convenience method to pick the debug level using the method name.
static void info(java.lang.String message)
          Convenience method to pick the debug level using method name.
static void log(java.lang.String message)
          Quick log method signature.
static void log(java.lang.String message, int level)
          A log message with a given level.
static void log(java.lang.String message, int level, java.lang.Object object)
          A log message with a level and the class that called this method.
static void setLevel(int level)
          Set the log level for future invocations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static int DEBUG
Message that contain information normally of use only when debugging a program.


INFO

public static int INFO
Informational messages.


NOTICE

public static int NOTICE
Conditions that are not error conditions, but that may require special handling.


WARNING

public static int WARNING
Warning messages


ERROR

public static int ERROR
Errors.


CRITICAL

public static int CRITICAL
Critical conditions.


ALERT

public static int ALERT
A condition that should be corrected immediately.


EMERGENCY

public static int EMERGENCY
A panic condition.


LEVEL

public static int LEVEL
Debug level Note: It has been made public for performance optimization to reduce overhead of including tracing messages

Constructor Detail

Log

public Log()
Method Detail

log

public static void log(java.lang.String message)
Quick log method signature. Only if the global level is set below zero will these messages not be printed.

Parameters:
message - a value of type 'String'

log

public static void log(java.lang.String message,
                       int level)
A log message with a given level.


log

public static void log(java.lang.String message,
                       int level,
                       java.lang.Object object)
A log message with a level and the class that called this method.

Parameters:
message - Log Message
level - Log level
object - Callers class.

debug

public static void debug(java.lang.Object o,
                         java.lang.String message)
Convenience method to pick the debug level using the method name.

Parameters:
o - The callers class.
message - Log mesasge.

error

public static void error(java.lang.Object o,
                         java.lang.String message)
Convenience method to pick the error level using the method nam.e

Parameters:
o - The callers class
message - Log Message

info

public static void info(java.lang.String message)
Convenience method to pick the debug level using method name.

Parameters:
message - a value of type 'String'

info

public static void info(java.lang.Object o,
                        java.lang.String message)
Convenience method to pick the debug level using the method name.

Parameters:
o - The callers class.
message - Log mesasge.

debug

public static void debug(java.lang.String message)
Convenience method to pick the debug level using method name.

Parameters:
message - a value of type 'String'

setLevel

public static void setLevel(int level)
Set the log level for future invocations.

Parameters:
level - a value of type 'int'

getLevel

public static int getLevel()
Return the log level.



Copyright © 2002-2003 Mark Pollack. All Rights Reserved.