logixia 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10780,6 +10780,28 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10780
10780
  this.config = {};
10781
10781
  }
10782
10782
  static #_ = this.loggerConfig = {};
10783
+ static #_2 = this._globalLogger = null;
10784
+ /**
10785
+ * Returns the global LogixiaLoggerService instance that was created when the
10786
+ * module booted. Useful for logging outside of NestJS DI — utility functions,
10787
+ * plain scripts, decorators — without injecting the service everywhere.
10788
+ *
10789
+ * Returns `null` if called before `LogixiaLoggerModule.forRoot[Async]()` has
10790
+ * been initialised (i.e. before the NestJS app has started).
10791
+ *
10792
+ * @example
10793
+ * ```ts
10794
+ * // some-util.ts
10795
+ * import { LogixiaLoggerModule } from 'logixia/nest';
10796
+ *
10797
+ * export function doSomething() {
10798
+ * LogixiaLoggerModule.getGlobalLogger()?.info('doing something');
10799
+ * }
10800
+ * ```
10801
+ */
10802
+ static getGlobalLogger() {
10803
+ return _LogixiaLoggerModule._globalLogger;
10804
+ }
10783
10805
  configure(consumer) {
10784
10806
  const { forRoutes = DEFAULT_ROUTES, exclude } = this.config;
10785
10807
  const middlewareConfig = (req, res, next) => {
@@ -10816,7 +10838,7 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10816
10838
  {
10817
10839
  provide: LogixiaLoggerService,
10818
10840
  useFactory: (loggerConfig) => {
10819
- return new LogixiaLoggerService({
10841
+ const service = new LogixiaLoggerService({
10820
10842
  level: "info",
10821
10843
  service: "NestJSApp",
10822
10844
  environment: "development",
@@ -10842,6 +10864,8 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10842
10864
  },
10843
10865
  ...loggerConfig
10844
10866
  });
10867
+ _LogixiaLoggerModule._globalLogger = service;
10868
+ return service;
10845
10869
  },
10846
10870
  inject: [LOGIXIA_LOGGER_CONFIG]
10847
10871
  },
@@ -10911,7 +10935,9 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10911
10935
  ...loggerConfig
10912
10936
  };
10913
10937
  _LogixiaLoggerModule.loggerConfig = defaultConfig;
10914
- return new LogixiaLoggerService(defaultConfig);
10938
+ const service = new LogixiaLoggerService(defaultConfig);
10939
+ _LogixiaLoggerModule._globalLogger = service;
10940
+ return service;
10915
10941
  },
10916
10942
  inject: [LOGIXIA_LOGGER_CONFIG]
10917
10943
  },
@@ -11251,4 +11277,4 @@ Object.defineProperty(exports, 'usePlugin', {
11251
11277
  return usePlugin;
11252
11278
  }
11253
11279
  });
11254
- //# sourceMappingURL=logitron-logger.module-BI5eI4X9.js.map
11280
+ //# sourceMappingURL=logitron-logger.module-EX78H9nm.js.map