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.
@@ -10775,6 +10775,28 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10775
10775
  this.config = {};
10776
10776
  }
10777
10777
  static #_ = this.loggerConfig = {};
10778
+ static #_2 = this._globalLogger = null;
10779
+ /**
10780
+ * Returns the global LogixiaLoggerService instance that was created when the
10781
+ * module booted. Useful for logging outside of NestJS DI — utility functions,
10782
+ * plain scripts, decorators — without injecting the service everywhere.
10783
+ *
10784
+ * Returns `null` if called before `LogixiaLoggerModule.forRoot[Async]()` has
10785
+ * been initialised (i.e. before the NestJS app has started).
10786
+ *
10787
+ * @example
10788
+ * ```ts
10789
+ * // some-util.ts
10790
+ * import { LogixiaLoggerModule } from 'logixia/nest';
10791
+ *
10792
+ * export function doSomething() {
10793
+ * LogixiaLoggerModule.getGlobalLogger()?.info('doing something');
10794
+ * }
10795
+ * ```
10796
+ */
10797
+ static getGlobalLogger() {
10798
+ return _LogixiaLoggerModule._globalLogger;
10799
+ }
10778
10800
  configure(consumer) {
10779
10801
  const { forRoutes = DEFAULT_ROUTES, exclude } = this.config;
10780
10802
  const middlewareConfig = (req, res, next) => {
@@ -10811,7 +10833,7 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10811
10833
  {
10812
10834
  provide: LogixiaLoggerService,
10813
10835
  useFactory: (loggerConfig) => {
10814
- return new LogixiaLoggerService({
10836
+ const service = new LogixiaLoggerService({
10815
10837
  level: "info",
10816
10838
  service: "NestJSApp",
10817
10839
  environment: "development",
@@ -10837,6 +10859,8 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10837
10859
  },
10838
10860
  ...loggerConfig
10839
10861
  });
10862
+ _LogixiaLoggerModule._globalLogger = service;
10863
+ return service;
10840
10864
  },
10841
10865
  inject: [LOGIXIA_LOGGER_CONFIG]
10842
10866
  },
@@ -10906,7 +10930,9 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10906
10930
  ...loggerConfig
10907
10931
  };
10908
10932
  _LogixiaLoggerModule.loggerConfig = defaultConfig;
10909
- return new LogixiaLoggerService(defaultConfig);
10933
+ const service = new LogixiaLoggerService(defaultConfig);
10934
+ _LogixiaLoggerModule._globalLogger = service;
10935
+ return service;
10910
10936
  },
10911
10937
  inject: [LOGIXIA_LOGGER_CONFIG]
10912
10938
  },
@@ -10971,4 +10997,4 @@ LogixiaLoggerModule = _LogixiaLoggerModule = __decorate([Module({})], LogixiaLog
10971
10997
 
10972
10998
  //#endregion
10973
10999
  export { redactObject as A, LogLevel as B, setTraceId as C, registerForShutdown as D, flushOnExit as E, isError as F, createExpressContextMiddleware as G, globalPluginRegistry as H, normalizeError as I, createFastifyContextHook as K, serializeError as L, getActiveOtelContext as M, getOtelMetaFields as N, resetShutdownHandlers as O, initOtelBridge as P, DEFAULT_LOG_COLORS as R, runWithTraceId as S, deregisterFromShutdown as T, usePlugin as U, PluginRegistry as V, LogixiaContext as W, createTraceMiddleware as _, TraceMiddleware as a, getCurrentTraceId as b, LogixiaLoggerService as c, LogixiaLogger as d, createLogger as f, _setActiveContextKey as g, TraceContext as h, WebSocketTraceInterceptor as i, disableOtelBridge as j, applyRedaction as k, __decorate as l, TRACE_CONTEXT_KEY as m, LOGIXIA_LOGGER_PREFIX as n, __decorateParam as o, DEFAULT_TRACE_HEADERS as p, LogixiaLoggerModule as r, KafkaTraceInterceptor as s, LOGIXIA_LOGGER_CONFIG as t, __decorateMetadata as u, extractTraceId as v, traceStorage as w, getTraceContextKey as x, generateTraceId as y, DEFAULT_LOG_LEVELS as z };
10974
- //# sourceMappingURL=logitron-logger.module-BvWgddzf.mjs.map
11000
+ //# sourceMappingURL=logitron-logger.module-kQTARPqg.mjs.map