velosurf.util
Class Logger

java.lang.Object
  extended by velosurf.util.Logger

public class Logger
extends java.lang.Object

this class is the logger used by velosurf

Author:
Claude Brisson

Field Summary
private static int asyncLimit
          max number of lines to log in asynchronous mode
(package private) static java.io.StringWriter asyncLog
          asynchronous log used at start
private static boolean captureStderr
          whether the logger captures stderr
private static boolean captureStdout
          whether the logger captures stdout
static int DEBUG_ID
          debug messages loglevel
private static boolean displayTimestamps
          whether to display timestamps
static int ERROR_ID
          error messages loglevel
static int FATAL_ID
          fatal messages loglevel
(package private) static java.text.SimpleDateFormat format
          date format for timestamps
static int INFO_ID
          info messages loglevel
private static boolean initialized
          Did someone give me an otput writer ?
(package private) static int lines
           
(package private) static java.io.PrintWriter log
          log output printwriter
private static int logLevel
          Current log level
(package private) static java.io.PrintStream oldStderr
          stderr old value
(package private) static java.io.PrintStream oldStdout
          stdout old value
static int TRACE_ID
          trace messages loglevel
static int WARN_ID
          warn messages loglevel
 
Constructor Summary
Logger()
           
 
Method Summary
static void debug(java.lang.String s)
          logs a debug string
static void dumpStack()
          dumps the current stack
static void error(java.lang.String s)
          logs an error string
static void fatal(java.lang.String s)
          logs a fatal error string
protected static void flushAsyncLog()
          flush the asynchronous log in the output writer
static int getLogLevel()
          Gets the current log level
static java.io.PrintWriter getWriter()
          get the output writer
protected static java.lang.String header()
          returns "Velosurf "
static void info(java.lang.String s)
          logs an info string
static boolean isInitialized()
          queries the initialized state
static void log(int level, java.lang.String s)
          log a string using a verbose level
protected static void log(java.lang.String s)
          logs a string
static void log(java.lang.String s, java.lang.Throwable e)
          logs an exception with a string
static void log(java.lang.Throwable e)
          log an exception
static void log2Stderr()
          log to stderr
static void log2Stdout()
          log to stdout
static void setDisplayTimestamps(boolean timestamps)
          whether to display timestamps
static void setLogLevel(int logLevel)
          Sets the log level
static void setWriter(java.lang.Object out)
          set the output writer
static void startCaptureStderr()
          redirects stderr towards the output writer
static void startCaptureStdout()
          redirects stdout towards output writer
static void stopCaptureStderr()
          stops redirecting stderr
static void stopCaptureStdout()
          stop redirecting stdout
static void trace(java.lang.String s)
          logs a tracing string
static void warn(java.lang.String s)
          logs a warning string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE_ID

public static final int TRACE_ID
trace messages loglevel

See Also:
Constant Field Values

DEBUG_ID

public static final int DEBUG_ID
debug messages loglevel

See Also:
Constant Field Values

INFO_ID

public static final int INFO_ID
info messages loglevel

See Also:
Constant Field Values

WARN_ID

public static final int WARN_ID
warn messages loglevel

See Also:
Constant Field Values

ERROR_ID

public static final int ERROR_ID
error messages loglevel

See Also:
Constant Field Values

FATAL_ID

public static final int FATAL_ID
fatal messages loglevel

See Also:
Constant Field Values

logLevel

private static int logLevel
Current log level


displayTimestamps

private static boolean displayTimestamps
whether to display timestamps


captureStdout

private static boolean captureStdout
whether the logger captures stdout


captureStderr

private static boolean captureStderr
whether the logger captures stderr


asyncLimit

private static int asyncLimit
max number of lines to log in asynchronous mode


initialized

private static boolean initialized
Did someone give me an otput writer ?


format

static java.text.SimpleDateFormat format
date format for timestamps


asyncLog

static java.io.StringWriter asyncLog
asynchronous log used at start


log

static java.io.PrintWriter log
log output printwriter


oldStdout

static java.io.PrintStream oldStdout
stdout old value


oldStderr

static java.io.PrintStream oldStderr
stderr old value


lines

static int lines
Constructor Detail

Logger

public Logger()
Method Detail

setLogLevel

public static void setLogLevel(int logLevel)
Sets the log level

Parameters:
logLevel - log level

setDisplayTimestamps

public static void setDisplayTimestamps(boolean timestamps)
whether to display timestamps


getLogLevel

public static int getLogLevel()
Gets the current log level

Returns:
the current log level

log

protected static void log(java.lang.String s)
logs a string

Parameters:
s - string

log

public static void log(java.lang.String s,
                       java.lang.Throwable e)
logs an exception with a string

Parameters:
s - string
e - exception

log

public static void log(java.lang.Throwable e)
log an exception

Parameters:
e - exception

log

public static void log(int level,
                       java.lang.String s)
log a string using a verbose level

Parameters:
level - verbose level
s - string to log

trace

public static void trace(java.lang.String s)
logs a tracing string

Parameters:
s - tracing string

debug

public static void debug(java.lang.String s)
logs a debug string

Parameters:
s - debug string

info

public static void info(java.lang.String s)
logs an info string

Parameters:
s - info string

warn

public static void warn(java.lang.String s)
logs a warning string

Parameters:
s - warning string

error

public static void error(java.lang.String s)
logs an error string

Parameters:
s - error string

fatal

public static void fatal(java.lang.String s)
logs a fatal error string

Parameters:
s - fatal error string

getWriter

public static java.io.PrintWriter getWriter()
get the output writer

Returns:
writer

setWriter

public static void setWriter(java.lang.Object out)
set the output writer

Parameters:
out - PrintWriter or Writer or OutputStream

startCaptureStdout

public static void startCaptureStdout()
redirects stdout towards output writer


stopCaptureStdout

public static void stopCaptureStdout()
stop redirecting stdout


startCaptureStderr

public static void startCaptureStderr()
redirects stderr towards the output writer


stopCaptureStderr

public static void stopCaptureStderr()
stops redirecting stderr


log2Stdout

public static void log2Stdout()
log to stdout


log2Stderr

public static void log2Stderr()
log to stderr


header

protected static java.lang.String header()
returns "Velosurf "

Returns:
return the header

flushAsyncLog

protected static void flushAsyncLog()
flush the asynchronous log in the output writer


isInitialized

public static boolean isInitialized()
queries the initialized state


dumpStack

public static void dumpStack()
dumps the current stack



~ooOoo~