package at.gv.egovernment.moa.logging;

/**
 * Encapsulates contextual information (i.e. per request information) for
 * logging purposes.
 * 
 * @author Patrick Peck
 * @version $Id$
 */
public class LoggingContext {
  /** The name of the node ID system property. */
  public static final String NODE_ID_PROPERTY = "moa.node-id";
  
  /** The current transaction ID. */
  private String transactionID;
  /** The node ID. */
  private String nodeID;
  
  /**
   * Create a new <code>LoggingContext</code>.
   * 
   * @param transactionID The transaction ID. May be <code>null</code>.
   */
  public LoggingContext(String transactionID) {
    this.transactionID = transactionID;
    this.nodeID = System.getProperty(NODE_ID_PROPERTY);
  }
  
  /**
   * Return the transaction ID.
   * 
   * @return The transaction ID.
   */
  public String getTransactionID() {
    return transactionID;
  }
  
  /**
   * Return the node ID.
   * 
   * @return The node ID.
   */
  public String getNodeID() {
    return nodeID;
  }
}