Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public interface MultiFileWriter {
  /**
   * get File manager for the log event. This file manager will be used to create, append-events, flush and close the file for the logging 
   * events of to fileentityId (logging-context)
   */
  void appendgetFileManager(Iterator<LogEvent>LogEvent eventsevent);
  

}
Code Block
interface FileManager {
  /**
   * createBased aon filethe correspondinglogEvent, toget the entityId and use timestampthat information andto returncreate the file.
   **/
  File createFile(EntityId entityId, LogEvent event);
 LogEvent logEvent); 

 /**
  * append log events to the currently active file belonging to the entityId represented by these log events. 
  * Logic : on the first append, we determine if the file has to be rotated or not using the RotationPolicy#shoudRotateFile(File file, LogEvent 
  * logEvent). If it has to be rotated, we will use RotationPolicy#rotateFile(File file, LogEvent logEvent) to rotate the file (close the old  
  * file) and append to the new file
  **/
  void appendEvents(Iterator<LogEvent> logEvents);  
 
  /**
   * close the currently active file.
   **/
  void close(File file);

  /**
   * flush the contents of the currently active file
   **/
  void flush(File file);
}

 

 

Code Block
public interface RotationPolicy {
  /**
   * For the logEvent, decide if we should rotate the current file corresponding to this event or not.
   */
  boolean shouldRotateFile(File file, LogEvent logEvent);
 
  /**
   * For the logEvent, rotate the log file based on rotation logic and return the newly created File.
   */
  File rotateFile(File file, LogEvent logEvent);
 
  /**
   * For the logEvent, get the currently active file used for appending the log events.
   */ 		
  File getActiveFile(LogEvent logEvent);
}

...