MjSip Stack
v1.6

org.zoolu.tools
Class Log

java.lang.Object
  |
  +--org.zoolu.tools.Log
Direct Known Subclasses:
RotatingLog

public class Log
extends java.lang.Object

Class Log allows the printing of log messages onto standard output or files or any PrintStream.

Every Log has a verboselevel associated with it; any log request with loglevel less or equal to the verbose-level is logged.
Verbose level 0 indicates no log. The log levels should be greater than 0.

Parameter logname, if non-null, is used as log header (i.e. written at the begin of each log row).


Field Summary
static long MAX_SIZE
          (static) Default maximum log file size (4MB)
 
Constructor Summary
Log(java.io.PrintStream out_stream, java.lang.String log_tag, int verbose_level)
          Associates a new Log to the PrintStream outstream.
Log(java.lang.String file_name, java.lang.String log_tag, int verbose_level)
          Associates a new Log to the file filename.
Log(java.lang.String file_name, java.lang.String log_tag, int verbose_level, long max_size)
          Associates a new Log to the file filename.
Log(java.lang.String file_name, java.lang.String log_tag, int verbose_level, long max_size, boolean append)
          Associates a new Log to the file filename.
 
Method Summary
 void close()
          Closes the log
protected  Log flush()
          Flushes
protected  void init(java.io.PrintStream out_stream, java.lang.String log_tag, int verbose_level, long max_size)
          Initializes the log
 Log print(java.lang.String message)
          Prints the log if the Log verbose_level is greater than 0
 Log print(java.lang.String message, int level)
          Prints the log if level isn't greater than the Log verbose_level
 Log printException(java.lang.Exception e)
          Logs the Exception.toString() and Exception.printStackTrace()
 Log printException(java.lang.Exception e, int level)
          Logs the Exception
 Log println(java.lang.String message)
          Prints the log if the Log verbose_level is greater than 0
 Log println(java.lang.String message, int level)
          Prints the log if level isn't greater than the Log verbose_level
 Log printPacketTimestamp(java.lang.String proto, java.lang.String remote_addr, int remote_port, int len, java.lang.String message, int level)
          Logs the packet timestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SIZE

public static final long MAX_SIZE
(static) Default maximum log file size (4MB)
Constructor Detail

Log

public Log(java.io.PrintStream out_stream,
           java.lang.String log_tag,
           int verbose_level)
Associates a new Log to the PrintStream outstream. Log size has no bound

Log

public Log(java.lang.String file_name,
           java.lang.String log_tag,
           int verbose_level)
Associates a new Log to the file filename. Log size is limited to the MAX_SIZE

Log

public Log(java.lang.String file_name,
           java.lang.String log_tag,
           int verbose_level,
           long max_size)
Associates a new Log to the file filename. Log size is limited to logsize [bytes]

Log

public Log(java.lang.String file_name,
           java.lang.String log_tag,
           int verbose_level,
           long max_size,
           boolean append)
Associates a new Log to the file filename. Log size is limited to logsize [bytes]
Method Detail

init

protected void init(java.io.PrintStream out_stream,
                    java.lang.String log_tag,
                    int verbose_level,
                    long max_size)
Initializes the log

flush

protected Log flush()
Flushes

close

public void close()
Closes the log

printException

public Log printException(java.lang.Exception e,
                          int level)
Logs the Exception

printException

public Log printException(java.lang.Exception e)
Logs the Exception.toString() and Exception.printStackTrace()

printPacketTimestamp

public Log printPacketTimestamp(java.lang.String proto,
                                java.lang.String remote_addr,
                                int remote_port,
                                int len,
                                java.lang.String message,
                                int level)
Logs the packet timestamp

println

public Log println(java.lang.String message,
                   int level)
Prints the log if level isn't greater than the Log verbose_level

println

public Log println(java.lang.String message)
Prints the log if the Log verbose_level is greater than 0

print

public Log print(java.lang.String message)
Prints the log if the Log verbose_level is greater than 0

print

public Log print(java.lang.String message,
                 int level)
Prints the log if level isn't greater than the Log verbose_level

MjSip Stack
v1.6