Source: model/logEvent.js

/**
 * Constructs a LogEvents given the log text, a {@link VectorTimestamp} and the
 * line number associated with this log event <>
 * 
 * @classdesc
 * 
 * A LogEvent represents a single event from the raw log and contains the text
 * of the log, a reference to the {@link VectorTimestamp}, and other contextual
 * information. LogEvents are immutable.
 * 
 * @constructor
 * @param {String} text the text of the log (description)
 * @param {VectorTimestamp} vectorTimestamp the vector timestamp of the log
 * @param {Number} lineNum the line number of the event in the log
 * @param {?Object<String, String>} [fields={}] a mapping of field names to
 *            field values extracted using regex.
 */
function LogEvent(text, vectorTimestamp, lineNum, fields) {
    /** @private */
    this.id = LogEvent.id++;

    /** @private */
    this.text = text;

    /** @private */
    this.host = vectorTimestamp.getOwnHost();

    /** @private */
    this.vectorTimestamp = vectorTimestamp;

    /** @private */
    this.lineNum = lineNum;

    /** @private */
    this.fields = Util.objectShallowCopy(fields) || {};
}

/**
 * Used to assign LogEvents unique IDs
 * 
 * @private
 * @static
 */
LogEvent.id = 0;

/**
 * Returns the LogEvent's unique ID
 * 
 * @returns {Number} the ID
 */
LogEvent.prototype.getId = function() {
    return this.id;
};

/**
 * Returns the log text associated with this LogEvent
 * 
 * @returns {String} the log text
 */
LogEvent.prototype.getText = function() {
    return this.text;
};

/**
 * Returns the host that the LogEvent was generated by
 * 
 * @returns {String} the name of the host
 */
LogEvent.prototype.getHost = function() {
    return this.host;
};

/**
 * Returns the VectorTimestamp associated with this LogEvent
 * 
 * @returns {VectorTimestamp}
 */
LogEvent.prototype.getVectorTimestamp = function() {
    return this.vectorTimestamp;
};

/**
 * Returns line number in the raw input string that this log event was parsed
 * from.
 * 
 * @returns {Number}
 */
LogEvent.prototype.getLineNumber = function() {
    return this.lineNum;
};

/**
 * Returns the custom captured fields for the log event.
 * 
 * @returns {Object<String, String>} The fields
 */
LogEvent.prototype.getFields = function() {
    return $.extend({}, this.fields);
};