You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JitsiMeetInMemoryLogStorage.js 1.2KB

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