Interface ProgressLog

All Known Implementing Classes:
ProgressLogImpl

public interface ProgressLog
This class provides log functionality for a task. This is not a system log, it's meant for informing the user about the single steps of a task. It's closely related to the current progress of a task (Progress).

Usage example:


 public Void call() {
 ProgressLog log = context.getProgressLog();

 // client.zipimport.extract_files=Archiv wird extrahiert
 log.log("client.zipimport.extract_archive");

 // do extract and count files...

 for ( int i = 0; i < totalCount; i++ ) {
 // client.zipimport.import_file=Datei [fileName] wird importiert
 Map<String, String> vars = Maps.newHashMap();
 vars.put( "fileName", fileName );
 LogEntry entry = log.log( "client.zipimport.import_file", vars );

 // do import file...

 entry.complete();
 }

 // client.zipimport.cleanup=Aufräumen
 log.log( "client.zipimport.cleanup" );

 // do cleanup...
 }
 

  • Method Details

    • log

      LogEntry log(String textKey)
      Log a message.

      Creates a new log entry with status "running". If the last log entry before this new entry is not completed, it will be completed automatically.

      Parameters:
      textKey - the key (textressources) of the message to display
      Returns:
      the created LogEntry
    • log

      LogEntry log(String textKey, Map<String,String> vars)
      Log a message.

      Creates a new log entry with status "running". If the last log entry before this new entry is not completed, it will be completed automatically.

      Parameters:
      textKey - the key (textressources) of the message to display
      vars - a map with the parameters to replace the placeholders in the log message with
      Returns:
      the created LogEntry
    • getLogEntries

      List<LogEntry> getLogEntries()
      Get e (unmodifiable) list containing the log entries.
      Returns:
      a list containing the log entries.
    • findLogEntryByState

      Optional<LogEntry> findLogEntryByState(String state)
      Find a single LogEntry for a given state value. This value must uniquely identify the log entry!

      If more than one result is found, an exception is thrown. Otherwise either the single result is returned or none.

    • findLatestLogEntry

      Optional<LogEntry> findLatestLogEntry()