logger.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * Logger used throughout the application to allow configuration of
  3. * the log level required for the messages.
  4. */
  5. export declare class Logger {
  6. /**
  7. * No log
  8. */
  9. static readonly NoneLogLevel = 0;
  10. /**
  11. * Only message logs
  12. */
  13. static readonly MessageLogLevel = 1;
  14. /**
  15. * Only warning logs
  16. */
  17. static readonly WarningLogLevel = 2;
  18. /**
  19. * Only error logs
  20. */
  21. static readonly ErrorLogLevel = 4;
  22. /**
  23. * All logs
  24. */
  25. static readonly AllLogLevel = 7;
  26. /**
  27. * Message to display when a message has been logged too many times
  28. */
  29. static MessageLimitReached: string;
  30. private static _LogCache;
  31. private static _LogLimitOutputs;
  32. private static _Levels;
  33. /**
  34. * Gets a value indicating the number of loading errors
  35. * @ignorenaming
  36. */
  37. static errorsCount: number;
  38. /**
  39. * Callback called when a new log is added
  40. */
  41. static OnNewCacheEntry: (entry: string) => void;
  42. private static _CheckLimit;
  43. private static _GenerateLimitMessage;
  44. private static _AddLogEntry;
  45. private static _FormatMessage;
  46. private static _LogDisabled;
  47. private static _LogEnabled;
  48. /**
  49. * Log a message to the console
  50. */
  51. static Log: (message: string | any[], limit?: number) => void;
  52. /**
  53. * Write a warning message to the console
  54. */
  55. static Warn: (message: string | any[], limit?: number) => void;
  56. /**
  57. * Write an error message to the console
  58. */
  59. static Error: (message: string | any[], limit?: number) => void;
  60. /**
  61. * Gets current log cache (list of logs)
  62. */
  63. static get LogCache(): string;
  64. /**
  65. * Clears the log cache
  66. */
  67. static ClearLogCache(): void;
  68. /**
  69. * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)
  70. */
  71. static set LogLevels(level: number);
  72. }