snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
59
react/features/base/logging/JitsiMeetInMemoryLogStorage.ts
Normal file
59
react/features/base/logging/JitsiMeetInMemoryLogStorage.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Implements in memory logs storage, used for testing/debugging.
|
||||
*
|
||||
*/
|
||||
export default class JitsiMeetInMemoryLogStorage {
|
||||
logs: string[] = [];
|
||||
|
||||
/**
|
||||
* Creates new <tt>JitsiMeetInMemoryLogStorage</tt>.
|
||||
*/
|
||||
constructor() {
|
||||
/**
|
||||
* Array of the log entries to keep.
|
||||
*
|
||||
* @type {array}
|
||||
*/
|
||||
this.logs = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this storage instance is ready.
|
||||
*
|
||||
* @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.
|
||||
* @returns {void}
|
||||
*/
|
||||
storeLogs(logEntries: (string | { text: string; })[]) {
|
||||
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 the logs stored in the memory.
|
||||
*
|
||||
* @returns {Array<string>} The collected log entries.
|
||||
*/
|
||||
getLogs() {
|
||||
return this.logs;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user