Sha256: 5d181d459cbb98d66b0b7dcdd80a83a86e705973b08cbb50a72a97d479166ae0

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

/*
  Class: LoggingEvent

  Contains all the data about single log event.
*/

/*
  Constructor: LoggingEvent

  Initializes event.

  Parameters:
    logger - <Logger> which was the event source
    timeStamp - Date of event occurrence
    level - <Level> of the log event
    messages - Array of messages in event
    exception - Exception of the message
*/
JLog.LoggingEvent = function(logger, timeStamp, level, messages, exception) {
  this.logger = logger;
  this.timeStamp = timeStamp;
  this.timeStampInMilliseconds = timeStamp.getTime();
  this.timeStampInSeconds = Math.floor(this.timeStampInMilliseconds / 1000);
  this.milliseconds = this.timeStamp.getMilliseconds();
  this.level = level;
  this.messages = messages;
  this.exception = exception;
};

/*
  Property: logger

  <Logger> which was the event source
*/

/*
  Property: timeStamp

  Date of event occurrence
*/

/*
  Property: level

  <Level> of the log event
*/

/*
  Property: messages

  Array of messages in event
*/

/*
  Property: exception

  Exception of the message
*/

JLog.LoggingEvent.prototype = {
  /*
    Method: getThrowableStrRep

    Returns exception of the message as a String.
  */
  getThrowableStrRep: function() {
    return this.exception ? JLog.getExceptionStringRep(this.exception) : "";
  },

  /*
    Method: getCombinedMessages

    Returns messages of the event joined with new line symbol.
  */
  getCombinedMessages: function() {
    return (this.messages.length == 1) ? this.messages[0] : this.messages.join(JLog.newLine);
  },
  toString: function() {
    return "LoggingEvent[" + this.level + "]";
  }
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jlog-rails-0.2.3 src/logging_event.js
jlog-rails-0.2.2 vendor/assets/javascripts/logging_event.js