Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.util
Class Log

    java.lang.Object
      com.mindbright.util.Log

public class Log
extends java.lang.Object

A class which handles logging messages to a stream. All printed messages are time-stamped. Messages can have different levels and it is possible to change which levels should be written to the stream. The levels are ordered like this (in decreasing order of severity):

1. `LEVEL_EMERG` - emergency messages
2. `LEVEL_ALERT` - alert messages
3. `LEVEL_ERROR` - error messages
4. `LEVEL_WARNING` - warning messages
5. `LEVEL_NOTICE` - notices
6. `LEVEL_INFO` - informational messages
7. `LEVEL_DEBUG` - debug messages
8. `LEVEL_DEBUG2` - detailed debug messages

Field Summary
`static int` | `LEVEL_ALERT`
`static int` | `LEVEL_DEBUG`
`static int` | `LEVEL_DEBUG2`
`static int` | `LEVEL_EMERG`
`static int` | `LEVEL_ERROR`
`static int` | `LEVEL_INFO`
`static int` | `LEVEL_NOTICE`
`static int` | `LEVEL_WARNING`

Constructor Summary
`Log(int level)` Construct an instance which logs to System.err and which ignores messages below the given level.
`Log(java.io.OutputStream logOut, int level)` Construct an instance which logs to the given stream and which ignores messages below the given level.

Method Summary
`void` | `close()` Closes the output stream (unless it is System.err)
`void` | `debug(java.lang.String callClass, java.lang.String message)` Log a debug message
`void` | `debug(java.lang.String callClass, java.lang.String callMethod, java.lang.String message)` Log a debug message
`void` | `debug2(java.lang.String callClass, java.lang.String callMethod, java.lang.String message)` Log a detailed debug message
`void` | `debug2(java.lang.String callClass, java.lang.String callMethod, java.lang.String message, byte[] dumpBuf)` Log a detailed debug message which also includes a hex-dump of some data.
`void` | `debug2(java.lang.String callClass, java.lang.String callMethod, java.lang.String message, byte[] dumpBuf, int off, int len)` Log a detailed debug message which also includes a hex-dump of some data.
`void` | `error(java.lang.String callClass, java.lang.String callMethod, java.lang.String message)` Log an error message
`void` | `info(java.lang.String callClass, java.lang.String message)` Log an informational message
`void` | `message(int level, java.lang.String callClass, java.lang.String message)` Log a message
`void` | `message(int level, java.lang.String callClass, java.lang.String callMethod, java.lang.String message)` Log a message
`void` | `notice(java.lang.String callClass, java.lang.String message)` Log a notice message
`void` | `setLevel(int level)` Change the log cutoff level.
`void` | `setLogOutputStream(java.io.OutputStream logOut)` Changes the stream log messages are printed on
`void` | `warning(java.lang.String callClass, java.lang.String message)` Log a warning message

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LEVEL_EMERG

    public static final int LEVEL_EMERG

See Also:
  Constant Field Values

### LEVEL_ALERT

    public static final int LEVEL_ALERT

See Also:
  Constant Field Values

### LEVEL_ERROR

    public static final int LEVEL_ERROR

See Also:
  Constant Field Values

### LEVEL_WARNING

    public static final int LEVEL_WARNING

See Also:
  Constant Field Values

### LEVEL_NOTICE

    public static final int LEVEL_NOTICE

See Also:
  Constant Field Values

### LEVEL_INFO

    public static final int LEVEL_INFO

See Also:
  Constant Field Values

### LEVEL_DEBUG

    public static final int LEVEL_DEBUG

See Also:
  Constant Field Values

### LEVEL_DEBUG2

    public static final int LEVEL_DEBUG2

See Also:
  Constant Field Values

Constructor Detail

### Log

    public Log(int level)

  Construct an instance which logs to System.err and which ignores messages below the given level.

Parameters:
  `level` - the lowest level of messages to log

### Log

    public Log(java.io.OutputStream logOut,
               int level)

  Construct an instance which logs to the given stream and which ignores messages below the given level.

Parameters:
  `logOut` - the stream to print log messages to
  `level` - the lowest level of messages to log

Method Detail

### setLogOutputStream

    public void setLogOutputStream(java.io.OutputStream logOut)

  Changes the stream log messages are printed on

  Parameters:
    `logOut` - the new stream to print messages on

### close

    public void close()

  Closes the output stream (unless it is System.err)

### message

    public void message(int level,
                        java.lang.String callClass,
                        java.lang.String message)

  Log a message

  Parameters:
    `level` - the severity of this message
    `callClass` - name of class generating the message
    `message` - the log message

### message

    public void message(int level,
                        java.lang.String callClass,
                        java.lang.String callMethod,
                        java.lang.String message)

  Log a message

  Parameters:
    `level` - the severity of this message
    `callClass` - name of class generating the message
    `callMethod` - name of method in calling class which generated message
    `message` - the log message

### error

    public void error(java.lang.String callClass,
                      java.lang.String callMethod,
                      java.lang.String message)

  Log an error message

  Parameters:
    `callClass` - name of class generating the message
    `callMethod` - name of method in calling class which generated message
    `message` - the log message

### warning

    public void warning(java.lang.String callClass,
                        java.lang.String message)

  Log a warning message

  Parameters:
    `callClass` - name of class generating the message
    `message` - the log message

### notice

    public void notice(java.lang.String callClass,
                       java.lang.String message)

  Log a notice message

  Parameters:
    `callClass` - name of class generating the message
    `message` - the log message

### info

    public void info(java.lang.String callClass,
                     java.lang.String message)

  Log an informational message

  Parameters:
    `callClass` - name of class generating the message
    `message` - the log message

### debug

    public void debug(java.lang.String callClass,
                      java.lang.String callMethod,
                      java.lang.String message)

  Log a debug message

  Parameters:
    `callClass` - name of class generating the message
    `callMethod` - name of method in calling class which generated message
    `message` - the log message

### debug

    public void debug(java.lang.String callClass,
                      java.lang.String message)

  Log a debug message

  Parameters:
    `callClass` - name of class generating the message
    `message` - the log message

### debug2

    public void debug2(java.lang.String callClass,
                       java.lang.String callMethod,
                       java.lang.String message)

  Log a detailed debug message

  Parameters:
    `callClass` - name of class generating the message
    `callMethod` - name of method in calling class which generated message
    `message` - the log message

### debug2

    public void debug2(java.lang.String callClass,
                       java.lang.String callMethod,
                       java.lang.String message,
                       byte[] dumpBuf,
                       int off,
                       int len)

  Log a detailed debug message which also includes a hex-dump of some data.

  Parameters:
    `callClass` - name of class generating the message
    `callMethod` - name of method in calling class which generated message
    `message` - the log message
    `dumpBuf` - array containing data to be dumped
    `off` - offset of first byte to dump
    `len` - number of bytes to dump

### debug2

    public void debug2(java.lang.String callClass,
                       java.lang.String callMethod,
                       java.lang.String message,
                       byte[] dumpBuf)

  Log a detailed debug message which also includes a hex-dump of some data.

  Parameters:
    `callClass` - name of class generating the message
    `callMethod` - name of method in calling class which generated message
    `message` - the log message
    `dumpBuf` - array containing data to be dumped

### setLevel

    public void setLevel(int level)

  Change the log cutoff level.

  Parameters:
    `level` - the lowest level of messages to log

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD