Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

JitsiMeetInMemoryLogStorage.ts 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Implements in memory logs storage, used for testing/debugging.
  3. *
  4. */
  5. export default class JitsiMeetInMemoryLogStorage {
  6. logs: string[] = [];
  7. /**
  8. * Creates new <tt>JitsiMeetInMemoryLogStorage</tt>.
  9. */
  10. constructor() {
  11. /**
  12. * Array of the log entries to keep.
  13. *
  14. * @type {array}
  15. */
  16. this.logs = [];
  17. }
  18. /**
  19. * Checks if this storage instance is ready.
  20. *
  21. * @returns {boolean} <tt>true</tt> when this storage is ready or
  22. * <tt>false</tt> otherwise.
  23. */
  24. isReady() {
  25. return true;
  26. }
  27. /**
  28. * Called by the <tt>LogCollector</tt> to store a series of log lines into
  29. * batch.
  30. *
  31. * @param {string|Object[]} logEntries - An array containing strings
  32. * representing log lines or aggregated lines objects.
  33. * @returns {void}
  34. */
  35. storeLogs(logEntries: (string | { text: string; })[]) {
  36. for (let i = 0, len = logEntries.length; i < len; i++) {
  37. const logEntry = logEntries[i];
  38. if (typeof logEntry === 'object') {
  39. this.logs.push(logEntry.text);
  40. } else {
  41. // Regular message
  42. this.logs.push(logEntry);
  43. }
  44. }
  45. }
  46. /**
  47. * Returns the logs stored in the memory.
  48. *
  49. * @returns {Array<string>} The collected log entries.
  50. */
  51. getLogs() {
  52. return this.logs;
  53. }
  54. }