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.js 1.2KB

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