Class SystemLog

java.lang.Object
fc.io.Log
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.

  • Constructor Details

    • 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 Details

    • 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 Log.getDebugContext(fc.io.LogLevel,int) 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • 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 Log.getDebugContext(fc.io.LogLevel,int) and is generated automatically by the warn(), info(), debug() etc., methods
      str2 - some arbitrary object
    • main

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