logger/lib/index.js

  1. import Logger from "./loggers/Logger.js";
  2. /**
  3. * Interface for the UI5 Tooling logging module
  4. *
  5. * @public
  6. * @module @ui5/logger
  7. */
  8. /**
  9. * Convenience function to create an instance of [@ui5/logger/Logger]{@link @ui5/logger/Logger}
  10. *
  11. * @public
  12. * @param {string} moduleName Identifier for messages created by the logger.
  13. * Example: <code>module:submodule:Class</code>
  14. * @returns {@ui5/logger/Logger}
  15. */
  16. export function getLogger(moduleName) {
  17. return new Logger(moduleName);
  18. }
  19. /**
  20. * Tests whether the provided log level is enabled by the current log level
  21. *
  22. * @public
  23. * @function
  24. * @param {string} levelName Log level to test
  25. * @returns {boolean} True if the provided level is enabled
  26. */
  27. export const isLogLevelEnabled = Logger.isLevelEnabled;
  28. /**
  29. * Sets the standard log level.
  30. * <br>
  31. * <b>Example:</b> Setting it to <code>perf</code> would suppress all <code>silly</code> and <code>verbose</code>
  32. * logging, and only show <code>perf</code>, <code>info</code>, <code>warn</code> and <code>error</code> logs.
  33. *
  34. * @public
  35. * @function
  36. * @param {string} levelName New log level
  37. */
  38. export const setLogLevel = Logger.setLevel;
  39. /**
  40. * Gets the current log level
  41. *
  42. * @public
  43. * @function
  44. * @returns {string} The current log level. Defaults to <code>info</code>
  45. */
  46. export const getLogLevel = Logger.getLevel;