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


Field Summary
static int DEBUG_ID
          Prefix for debug messages.
static int ERROR_ID
          Prefix for error messages.
static int INFO_ID
          Prefix for info messages.
(package private) static int lines
           
static int mLogLevel
          Current log level
private static int sAsyncLimit
          max number of lines to log in asynchronous mode
(package private) static java.io.StringWriter sAsyncLog
          asynchronous log used at start
private static boolean sCaptureStderr
          whether the logger captures stderr
private static boolean sCaptureStdout
          whether the logger captures stdout
(package private) static java.text.SimpleDateFormat sFormat
          date format for timestamps
(package private) static java.io.PrintWriter sLog
          log output printwriter
(package private) static java.io.PrintStream sOldStderr
          stderr old value
(package private) static java.io.PrintStream sOldStdout
          stdout old value
static int TRACE_ID
          Prefix for trace messages.
static int WARN_ID
          Prefix for warning messages.
 
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
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 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 setLogLevel(int inLogLevel)
          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
Prefix for trace messages.

See Also:
Constant Field Values

DEBUG_ID

public static final int DEBUG_ID
Prefix for debug messages.

See Also:
Constant Field Values

INFO_ID

public static final int INFO_ID
Prefix for info messages.

See Also:
Constant Field Values

WARN_ID

public static final int WARN_ID
Prefix for warning messages.

See Also:
Constant Field Values

ERROR_ID

public static final int ERROR_ID
Prefix for error messages.

See Also:
Constant Field Values

mLogLevel

public static int mLogLevel
Current log level


sCaptureStdout

private static boolean sCaptureStdout
whether the logger captures stdout


sCaptureStderr

private static boolean sCaptureStderr
whether the logger captures stderr


sAsyncLimit

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


sFormat

static java.text.SimpleDateFormat sFormat
date format for timestamps


sAsyncLog

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


sLog

static java.io.PrintWriter sLog
log output printwriter


sOldStdout

static java.io.PrintStream sOldStdout
stdout old value


sOldStderr

static java.io.PrintStream sOldStderr
stderr old value


lines

static int lines
Constructor Detail

Logger

public Logger()
Method Detail

setLogLevel

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

Parameters:
inLogLevel - log level

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

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


dumpStack

public static void dumpStack()
dumps the current stack



~ooOoo~