edu.isi.pegasus.common.logging

## Interface LogFormatter

All Known Implementing Classes:
  AbstractLogFormatter, Netlogger, Simple

    public interface LogFormatter

The interface that defines how the messages need to be formatted for logging

Version:
  $Revision$
Author:
  Karan Vahi, Gaurang Mehta

### Method Summary

All Methods Instance Methods Abstract Methods
`LogFormatter` `add(java.lang.String value)` Add to the log message with just a value.
`LogFormatter` `add(java.lang.String key, java.lang.String value)` Add to the log message.
`void` `addEvent(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> map)` Adds the event that is to be associated with the log messages onto an internal stack
`void` `addEvent(java.lang.String name, java.lang.String entityName, java.lang.String entityID)` Adds the event that is to be associated with the log messages onto an internal stack
`java.lang.String` `createEntityHierarchyMessage(java.lang.String parentType, java.lang.String parentID, java.lang.String childIdType, java.util.Collection<java.lang.String> childIDs)` Creates a log message that connects the parent entities with the children.
`java.lang.String` `createLogMessage()` Creates a log message with the contents of the internal log buffer.
`java.lang.String` `createLogMessageAndReset()` Creates a log message with the contents of the internal log buffer.
`java.lang.String` `getEndEventMessage()` Creates the end message for the event on top of the stack.
`java.lang.String` `getEventName()` Returns the name of event that is currently associated with the log messages and is on the top of the stack
`java.lang.String` `getProgramName(java.lang.String name)` Returns the program name for the software whose log statement are logged.
`java.lang.String` `getStartEventMessage()` Creates the start message for the event on top of the internal stack
`Event` `popEvent()` Pop the event on top of the internal stack.
`void` `setProgramName(java.lang.String name)` Sets the program name for the software whose log statement are logged.

### Method Detail

#### setProgramName

    void setProgramName(java.lang.String name)

Sets the program name for the software whose log statement are logged.

Parameters:
  `name` -

#### getProgramName

    java.lang.String getProgramName(java.lang.String name)

Returns the program name for the software whose log statement are logged.

Parameters:
  `name` -
Returns:
  name of the program

#### addEvent

    void addEvent(java.lang.String name,
                  java.lang.String entityName,
                  java.lang.String entityID)

Adds the event that is to be associated with the log messages onto an internal stack

Parameters:
  `name` - the name of the event to be associated
  `entityName` - the primary entity that is associated with the event e.g. workflow
  `entityID` - the id of that entity.

#### addEvent

    void addEvent(java.lang.String name,
                  java.util.Map<java.lang.String,java.lang.String> map)

Adds the event that is to be associated with the log messages onto an internal stack

Parameters:
  `name` - the name of the event to be associated
  `map` - Map indexed by entity name . The values is corresponding EntityID

#### popEvent

    Event popEvent()

Pop the event on top of the internal stack.

Returns:
  event on top , else null

#### getEventName

    java.lang.String getEventName()

Returns the name of event that is currently associated with the log messages and is on the top of the stack

Returns:
  name of the event.

#### getStartEventMessage

    java.lang.String getStartEventMessage()

Creates the start message for the event on top of the internal stack

Returns:
  start event message

#### getEndEventMessage

    java.lang.String getEndEventMessage()

Creates the end message for the event on top of the stack.

Returns:
  end event message

#### add

    LogFormatter add(java.lang.String value)

Add to the log message with just a value.

Parameters:
  `value` -
Returns:
  self-reference

#### add

    LogFormatter add(java.lang.String key,
                     java.lang.String value)

Add to the log message.

Parameters:
  `key` -
  `value` -
Returns:
  Self-reference, so calls can be chained

#### createLogMessage

    java.lang.String createLogMessage()

Creates a log message with the contents of the internal log buffer.

Returns:
  log message

#### createLogMessageAndReset

    java.lang.String createLogMessageAndReset()

Creates a log message with the contents of the internal log buffer. It then resets the buffer before returning the log message

Returns:
  the log message

#### createEntityHierarchyMessage

    java.lang.String createEntityHierarchyMessage(java.lang.String parentType,
                                                  java.lang.String parentID,
                                                  java.lang.String childIdType,
                                                  java.util.Collection<java.lang.String> childIDs)

Creates a log message that connects the parent entities with the children. For e.g. can we use to create the log messages connecting the jobs with the workflow they are part of.

Parameters:
  `parentType` - the type of parent entity
  `parentID` - the id of the parent entity
  `childIdType` - the type of children entities
  `childIDs` - Collection of children id's
Returns:
  entity hierarchy message.