fc.io
Class SystemLog

java.lang.Object
  extended by fc.io.Log
      extended by fc.io.SystemLog

public class SystemLog
extends Log

A default implementation of Log that provides logging to a PrintStream destination and is intended for sending normal application logs to System.{out, error}

Messages written to output destinations depend upon the flushing policy of the output destination. Destinations that use System.{err,out} will flush messages after every log method invocation.

This class should be sufficient for all logging tasks. However custom loggers that subclass Log can also be written if really desired.


Field Summary
 
Fields inherited from class fc.io.Log
DEBUG, DEFAULT_LEVEL, ERROR, INFO, OFF, WARN
 
Constructor Summary
SystemLog(String name)
          Creates a new SystemLog with a default destination of System.err and a default level of Log.DEFAULT_LEVEL
SystemLog(String name, PrintStream out)
          Creates a new SystemLog with the specified destination and a default level of Log.DEFAULT_LEVEL
SystemLog(String name, PrintStream out, LogLevel loglevel)
          Creates a new SystemLog.
 
Method Summary
 void close()
          Closes the log by flushing the destination PrintStream.
 void log(LogLevel level, Object str1)
           
 void log(LogLevel level, Object str1, Object str2)
           
 void log(LogLevel level, Object str1, Object str2, Object str3)
           
 void log(LogLevel level, Object str1, Object str2, Object str3, Object str4)
           
 void log(LogLevel level, Object str1, Object str2, Object str3, Object str4, Object str5)
           
 void log(LogLevel level, Object str1, Object str2, Object str3, Object str4, Object str5, Object str6)
           
 void log(LogLevel level, Object str1, Object str2, Object str3, Object str4, Object str5, Object str6, Object str7)
           
 void log(LogLevel level, Object str1, Object str2, Object str3, Object str4, Object str5, Object str6, Object str7, Object str8)
           
 void log(LogLevel level, Object str1, Object str2, Object str3, Object str4, Object str5, Object str6, Object str7, Object str8, Object... args)
           
static void main(String[] args)
           
 
Methods inherited from class fc.io.Log
bug, bug, bug, bug, bug, bug, bug, bug, canLog, closeLog, debug, debug, debug, debug, debug, debug, debug, debug, error, error, error, error, error, error, error, error, get, get, get, getDebugContext, getDefault, getLevel, getLevelNames, getLog, getName, info, info, info, info, info, info, info, info, logSystemInfo, printLevelName, printMethodInfoAtLevel, printRelativeTimestamp, printTimestamp, setDefaultLevel, setDefaultLevel, setLevel, setLevel, setLevelForAll, toString, warn, warn, warn, warn, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SystemLog

public SystemLog(String name)
Creates a new SystemLog with a default destination of System.err and a default level of Log.DEFAULT_LEVEL

Parameters:
name - name of this log (any arbitrary string)

SystemLog

public SystemLog(String name,
                 PrintStream out)
Creates a new SystemLog with the specified destination and a default level of Log.DEFAULT_LEVEL

Parameters:
name - name of this log (any arbitrary string)
out - the output destination

SystemLog

public SystemLog(String name,
                 PrintStream out,
                 LogLevel loglevel)
Creates a new SystemLog. The newly created log will automatically add itself to the list of all logs maintained by Log and a subsequent call to Log.get(String) with the same name will return this log.

Parameters:
name - name of this log (any arbitrary string)
out - the output destination
loglevel - the logging level
Method Detail

close

public void close()
Closes the log by flushing the destination PrintStream. close() is not called on the PrintStream since it would make PrintStreams like System.out unusable by other code.

Specified by:
close in class Log

log

public void log(LogLevel level,
                Object str1)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3,
                Object str4)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3,
                Object str4,
                Object str5)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3,
                Object str4,
                Object str5,
                Object str6)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3,
                Object str4,
                Object str5,
                Object str6,
                Object str7)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3,
                Object str4,
                Object str5,
                Object str6,
                Object str7,
                Object str8)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

log

public void log(LogLevel level,
                Object str1,
                Object str2,
                Object str3,
                Object str4,
                Object str5,
                Object str6,
                Object str7,
                Object str8,
                Object... args)
Specified by:
log in class Log
Parameters:
level - the current log level. This can be logged as well.
str1 - unless overridden in a subclass, this is the value returned by getDebugContext and is generated automatically by the warn(), info(), debug() etc., methods

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception