forked from jitsi/jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds in memory log storage, to be used while testing. (jitsi#2858)
* Adds in memory log storage, to be used while testing. Enabling it only when config.debug is set, a configuration provided by jitsi-meet-torture. * Moves to using config.testing.testMode property for logs storage. * Fixes comments.
- Loading branch information
Showing
3 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Implements in memory logs storage, used for testing/debugging. | ||
*/ | ||
export default class JitsiMeetInMemoryLogStorage { | ||
|
||
/** | ||
* Creates new <tt>JitsiMeetInMemoryLogStorage</tt> | ||
*/ | ||
constructor() { | ||
/** | ||
* Array of the log entries to keep. | ||
* @type {array} | ||
*/ | ||
this.logs = []; | ||
} | ||
|
||
/** | ||
* @returns {boolean} <tt>true</tt> when this storage is ready or | ||
* <tt>false</tt> otherwise. | ||
*/ | ||
isReady() { | ||
return true; | ||
} | ||
|
||
/** | ||
* Called by the <tt>LogCollector</tt> to store a series of log lines into | ||
* batch. | ||
* @param {string|object[]} logEntries an array containing strings | ||
* representing log lines or aggregated lines objects. | ||
*/ | ||
storeLogs(logEntries) { | ||
for (let i = 0, len = logEntries.length; i < len; i++) { | ||
const logEntry = logEntries[i]; | ||
|
||
if (typeof logEntry === 'object') { | ||
this.logs.push(logEntry.text); | ||
} else { | ||
// Regular message | ||
this.logs.push(logEntry); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @returns {array} the collected log entries. | ||
*/ | ||
getLogs() { | ||
return this.logs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.