logger.js 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getLogger = getLogger;
  6. exports.setLogger = setLogger;
  7. var _defaults = _interopRequireDefault(require("./defaults"));
  8. var _WinstonLoggerAdapter = require("./Adapters/Logger/WinstonLoggerAdapter");
  9. var _LoggerController = require("./Controllers/LoggerController");
  10. function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
  11. // Used for Separate Live Query Server
  12. function defaultLogger() {
  13. const options = {
  14. logsFolder: _defaults.default.logsFolder,
  15. jsonLogs: _defaults.default.jsonLogs,
  16. verbose: _defaults.default.verbose,
  17. silent: _defaults.default.silent
  18. };
  19. const adapter = new _WinstonLoggerAdapter.WinstonLoggerAdapter(options);
  20. return new _LoggerController.LoggerController(adapter, null, options);
  21. }
  22. let logger = defaultLogger();
  23. function setLogger(aLogger) {
  24. logger = aLogger;
  25. }
  26. function getLogger() {
  27. return logger;
  28. }
  29. // for: `import logger from './logger'`
  30. Object.defineProperty(module.exports, 'default', {
  31. get: getLogger
  32. });
  33. // for: `import { logger } from './logger'`
  34. Object.defineProperty(module.exports, 'logger', {
  35. get: getLogger
  36. });
  37. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsImV4cG9ydHMiLCJ2YWx1ZSIsImdldExvZ2dlciIsInNldExvZ2dlciIsIl9kZWZhdWx0cyIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX1dpbnN0b25Mb2dnZXJBZGFwdGVyIiwiX0xvZ2dlckNvbnRyb2xsZXIiLCJlIiwiX19lc01vZHVsZSIsImRlZmF1bHQiLCJkZWZhdWx0TG9nZ2VyIiwib3B0aW9ucyIsImxvZ3NGb2xkZXIiLCJkZWZhdWx0cyIsImpzb25Mb2dzIiwidmVyYm9zZ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