Class StructuredLogger

java.lang.Object
com.pnfsoftware.jeb.util.logging.StructuredLogger
All Implemented Interfaces:
ILogger

public class StructuredLogger extends Object implements ILogger
The structured logger can generate HTML formatted log.
  • Constructor Details

    • StructuredLogger

      public StructuredLogger(String name)
      Create a structured logger with structured and regular logging enabled.
      Parameters:
      name - the logger's name
    • StructuredLogger

      public StructuredLogger(String name, boolean slEnabled, boolean rlEnabled)
      Create a structured logger.
      Parameters:
      name - the logger's name
      slEnabled - true to enable structured logging; when logging is complete, the structured log may be dumped to HTML using a StructuredLoggerHtmlGenerator
      rlEnabled - true to enable regular logging (eg, to console) as well
  • Method Details

    • isStructuredLoggingEnabled

      public boolean isStructuredLoggingEnabled()
    • isRegularLoggingEnabled

      public boolean isRegularLoggingEnabled()
    • hasStructuredContents

      public boolean hasStructuredContents()
    • beginSection

      public void beginSection(String name, boolean defaultOpen)
    • beginSection

      public void beginSection(String name)
    • closeSection

      public void closeSection()
    • generateHtml

      public String generateHtml()
    • generateHtml

      public void generateHtml(FileOutputStream out, Charset charset)
      Same as generateHtml but per blocks. To use if result is too large.
      Parameters:
      out -
    • getName

      public String getName()
      Specified by:
      getName in interface ILogger
      Returns:
    • setName

      public void setName(String name)
    • setEnabledLevel

      public void setEnabledLevel(int level)
      Description copied from interface: ILogger
      Set the cut-off level for a logger.
      Specified by:
      setEnabledLevel in interface ILogger
      Parameters:
      level - the cut-off level: all logging calls with a level equal or above to the cut-off will be displayed
    • getEnabledLevel

      public int getEnabledLevel()
      Description copied from interface: ILogger
      Retrieve the cut-off level for that logger.
      Specified by:
      getEnabledLevel in interface ILogger
      Returns:
      the level, a number between 0 and GlobalLog.LEVEL_CATCHING
    • log

      public void log(int level, boolean raw, String format, Object... params)
      Description copied from interface: ILogger
      Log a string message.
      Specified by:
      log in interface ILogger
    • log

      public void log(int importance, int level, boolean raw, String format, Object... params)
    • i

      public void i(String format, Object... params)
      Description copied from interface: ILogger
      Reserved for internal logging. In Release builds, calling this method does nothing.
      Specified by:
      i in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • iH

      public void iH(String format, Object... params)
    • iHH

      public void iHH(String format, Object... params)
    • iHHH

      public void iHHH(String format, Object... params)
    • iHHHH

      public void iHHHH(String format, Object... params)
    • iHHHHH

      public void iHHHHH(String format, Object... params)
    • iL

      public void iL(String format, Object... params)
    • i

      public void i(int importance, String format, Object... params)
    • iBreak

      public void iBreak()
    • iBreak

      public void iBreak(int cnt)
    • iSeparator

      public void iSeparator()
    • trace

      public void trace(String format, Object... params)
      Description copied from interface: ILogger
      Log a trace message.
      Specified by:
      trace in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • fine

      public void fine(String format, Object... params)
      Description copied from interface: ILogger
      Alias for warn(). Log a trace message.
      Specified by:
      fine in interface ILogger
    • debug

      public void debug(String format, Object... params)
      Description copied from interface: ILogger
      Log a debug message.
      Specified by:
      debug in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • info

      public void info(String format, Object... params)
      Description copied from interface: ILogger
      Log an information message.
      Specified by:
      info in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • warn

      public void warn(String format, Object... params)
      Description copied from interface: ILogger
      Log a warning message.
      Specified by:
      warn in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • warning

      public void warning(String format, Object... params)
      Description copied from interface: ILogger
      Alias for warn(). Log a warning message.
      Specified by:
      warning in interface ILogger
    • error

      public void error(String format, Object... params)
      Description copied from interface: ILogger
      Log an error message.
      Specified by:
      error in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • severe

      public void severe(String format, Object... params)
      Description copied from interface: ILogger
      Alias for error(). Log an error message.
      Specified by:
      severe in interface ILogger
      Parameters:
      format - format string if parameters are provided, else standard string
      params - parameters
    • catching

      public void catching(Throwable t)
      Description copied from interface: ILogger
      Log an exception's stack trace.
      Specified by:
      catching in interface ILogger
      Parameters:
      t - the throwable
    • catching

      public void catching(Throwable t, String message)
      Description copied from interface: ILogger
      Log an exception's stack trace, prefixed by an optional message.
      Specified by:
      catching in interface ILogger
      message - optional message prefixing stack trace
    • catching

      public void catching(Throwable t, String format, Object... params)
      Description copied from interface: ILogger
      Log an exception's stack trace, prefixed by an optional message.
      Specified by:
      catching in interface ILogger
    • catchingSilent

      public void catchingSilent(Throwable t)
      Description copied from interface: ILogger
      Log an exception at the debug level.
      Specified by:
      catchingSilent in interface ILogger
      Parameters:
      t - the throwable
    • status

      public void status(String format, Object... params)
      Description copied from interface: ILogger
      Log a transient status message (STATUS). Status messages are not directed to the regular output destinations; instead, they are directed to the status sinks. Only the newest message is stored in the sink.
      Specified by:
      status in interface ILogger