@adatechnology/logger 0.0.8 → 0.0.10

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.
package/dist/index.js CHANGED
@@ -8999,9 +8999,11 @@ var require_operators = __commonJS({
8999
8999
  var index_exports = {};
9000
9000
  __export(index_exports, {
9001
9001
  DEFAULT_LOGGER_CONFIG: () => DEFAULT_LOGGER_CONFIG,
9002
+ ExcludeHttpLogging: () => ExcludeHttpLogging,
9002
9003
  HTTP_LOGGING_INTERCEPTOR: () => HTTP_LOGGING_INTERCEPTOR,
9003
9004
  HTTP_LOGGING_INTERCEPTOR_CONTEXT: () => HTTP_LOGGING_INTERCEPTOR_CONTEXT,
9004
9005
  HttpLoggingInterceptor: () => HttpLoggingInterceptor,
9006
+ LOGGER_CONFIG: () => LOGGER_CONFIG,
9005
9007
  LOGGER_PROVIDER: () => LOGGER_PROVIDER,
9006
9008
  LoggerModule: () => LoggerModule,
9007
9009
  RequestContextMiddleware: () => RequestContextMiddleware,
@@ -9011,7 +9013,7 @@ __export(index_exports, {
9011
9013
  module.exports = __toCommonJS(index_exports);
9012
9014
 
9013
9015
  // src/logger.module.ts
9014
- var import_common5 = require("@nestjs/common");
9016
+ var import_common6 = require("@nestjs/common");
9015
9017
 
9016
9018
  // src/logger.provider.ts
9017
9019
  var import_common = require("@nestjs/common");
@@ -9047,23 +9049,22 @@ var LoggerProvider = class {
9047
9049
  constructor(implementation) {
9048
9050
  this.implementation = implementation;
9049
9051
  }
9050
- debug(...args) {
9051
- return this.implementation.debug(...args);
9052
+ debug(params) {
9053
+ return this.implementation.debug(params);
9052
9054
  }
9053
- info(...args) {
9054
- return this.implementation.info(...args);
9055
+ info(params) {
9056
+ return this.implementation.info(params);
9055
9057
  }
9056
- warn(...args) {
9057
- return this.implementation.warn(...args);
9058
+ warn(params) {
9059
+ return this.implementation.warn(params);
9058
9060
  }
9059
- error(...args) {
9060
- return this.implementation.error(...args);
9061
+ error(params) {
9062
+ return this.implementation.error(params);
9061
9063
  }
9062
9064
  setContext(context) {
9063
9065
  if (typeof this.implementation.setContext === "function") {
9064
9066
  return this.implementation.setContext(context);
9065
9067
  }
9066
- return;
9067
9068
  }
9068
9069
  };
9069
9070
  LoggerProvider = _ts_decorate([
@@ -9077,12 +9078,13 @@ LoggerProvider = _ts_decorate([
9077
9078
 
9078
9079
  // src/logger.token.ts
9079
9080
  var LOGGER_PROVIDER = "LOGGER_PROVIDER";
9081
+ var LOGGER_CONFIG = "LOGGER_CONFIG";
9080
9082
  var HTTP_LOGGING_INTERCEPTOR = "HTTP_LOGGING_INTERCEPTOR";
9081
9083
 
9082
9084
  // src/implementations/winston/winston.logger.module.ts
9083
9085
  var import_common3 = require("@nestjs/common");
9084
9086
  var import_winston2 = require("winston");
9085
- var import_util = require("util");
9087
+ var import_node_util = require("util");
9086
9088
 
9087
9089
  // src/implementations/winston/winston.logger.provider.ts
9088
9090
  var import_common2 = require("@nestjs/common");
@@ -9098,8 +9100,8 @@ var LoggerLevel = /* @__PURE__ */ (function(LoggerLevel2) {
9098
9100
  })({});
9099
9101
 
9100
9102
  // src/context/async-context.service.ts
9101
- var import_async_hooks = require("async_hooks");
9102
- var asyncLocalStorage = new import_async_hooks.AsyncLocalStorage();
9103
+ var import_node_async_hooks = require("async_hooks");
9104
+ var asyncLocalStorage = new import_node_async_hooks.AsyncLocalStorage();
9103
9105
  function getContext() {
9104
9106
  return asyncLocalStorage.getStore();
9105
9107
  }
@@ -9163,44 +9165,45 @@ var WinstonLoggerProvider = class {
9163
9165
  this.logger = logger;
9164
9166
  this.obfuscator = obfuscator;
9165
9167
  }
9166
- debug(messageOrPayload, meta, context) {
9167
- this.handleLog(LoggerLevel.DEBUG, messageOrPayload, meta, context);
9168
+ debug(payload) {
9169
+ this.log({
9170
+ level: LoggerLevel.DEBUG,
9171
+ payload: {
9172
+ ...payload,
9173
+ context: payload.context || this.context
9174
+ }
9175
+ });
9168
9176
  }
9169
- info(messageOrPayload, meta, context) {
9170
- this.handleLog(LoggerLevel.INFO, messageOrPayload, meta, context);
9177
+ info(payload) {
9178
+ this.log({
9179
+ level: LoggerLevel.INFO,
9180
+ payload: {
9181
+ ...payload,
9182
+ context: payload.context || this.context
9183
+ }
9184
+ });
9171
9185
  }
9172
- warn(messageOrPayload, meta, context) {
9173
- this.handleLog(LoggerLevel.WARN, messageOrPayload, meta, context);
9186
+ warn(payload) {
9187
+ this.log({
9188
+ level: LoggerLevel.WARN,
9189
+ payload: {
9190
+ ...payload,
9191
+ context: payload.context || this.context
9192
+ }
9193
+ });
9174
9194
  }
9175
- error(messageOrPayload, meta, context) {
9176
- this.handleLog(LoggerLevel.ERROR, messageOrPayload, meta, context);
9195
+ error(payload) {
9196
+ this.log({
9197
+ level: LoggerLevel.ERROR,
9198
+ payload: {
9199
+ ...payload,
9200
+ context: payload.context || this.context
9201
+ }
9202
+ });
9177
9203
  }
9178
9204
  setContext(context) {
9179
9205
  this.context = context;
9180
9206
  }
9181
- handleLog(level, messageOrPayload, meta, context) {
9182
- let payload;
9183
- if (typeof messageOrPayload === "string") {
9184
- payload = {
9185
- message: messageOrPayload,
9186
- meta,
9187
- context: context || this.context
9188
- };
9189
- } else {
9190
- payload = {
9191
- ...messageOrPayload,
9192
- context: messageOrPayload.context || context || this.context,
9193
- meta: {
9194
- ...messageOrPayload.meta,
9195
- ...meta
9196
- }
9197
- };
9198
- }
9199
- this.log({
9200
- level,
9201
- payload
9202
- });
9203
- }
9204
9207
  log(params) {
9205
9208
  const { level, payload } = params;
9206
9209
  const { message, context, meta, ...rest } = payload;
@@ -9212,7 +9215,7 @@ var WinstonLoggerProvider = class {
9212
9215
  const logInfo = {
9213
9216
  ...rest,
9214
9217
  context: messageContext,
9215
- requestId: requestIdFromContext || payload.requestId,
9218
+ requestId: requestIdFromContext || rest.requestId,
9216
9219
  meta: obfuscatedMeta
9217
9220
  };
9218
9221
  this.logger.log(level, messageText, logInfo);
@@ -9329,6 +9332,163 @@ function _ts_decorate3(decorators, target, key, desc) {
9329
9332
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9330
9333
  }
9331
9334
  __name(_ts_decorate3, "_ts_decorate");
9335
+ function asString(value) {
9336
+ if (typeof value === "string") return value;
9337
+ if (typeof value === "number" || typeof value === "boolean") {
9338
+ return String(value);
9339
+ }
9340
+ return void 0;
9341
+ }
9342
+ __name(asString, "asString");
9343
+ function colorizeText(useColors, color, reset, text) {
9344
+ return useColors ? `${color}${text}${reset}` : text;
9345
+ }
9346
+ __name(colorizeText, "colorizeText");
9347
+ function fillInfoFromMeta(info) {
9348
+ if (!info.meta || typeof info.meta !== "object") return;
9349
+ const meta = info.meta;
9350
+ const metadataKeys = [
9351
+ "requestId",
9352
+ "context",
9353
+ "source",
9354
+ "lib",
9355
+ "libVersion",
9356
+ "libMethod",
9357
+ "appName",
9358
+ "appVersion"
9359
+ ];
9360
+ for (const key of metadataKeys) {
9361
+ if (meta[key] && !info[key]) {
9362
+ info[key] = meta[key];
9363
+ delete meta[key];
9364
+ }
9365
+ }
9366
+ const logContext = meta.logContext;
9367
+ if (!logContext || info.source) return;
9368
+ const className = asString(logContext.className);
9369
+ const methodName = asString(logContext.methodName);
9370
+ if (className && methodName) {
9371
+ info.source = `${className}.${methodName}`;
9372
+ } else if (className) {
9373
+ info.source = className;
9374
+ } else if (methodName) {
9375
+ info.source = methodName;
9376
+ }
9377
+ }
9378
+ __name(fillInfoFromMeta, "fillInfoFromMeta");
9379
+ function applyDefaultInfoValues(info, config) {
9380
+ info.requestId = info.requestId || "no-request-id";
9381
+ info.context = info.context || config?.context || "App";
9382
+ info.appName = info.appName || config?.appName;
9383
+ info.appVersion = info.appVersion || config?.appVersion;
9384
+ info.lib = info.lib || config?.lib;
9385
+ info.libVersion = info.libVersion || config?.libVersion;
9386
+ }
9387
+ __name(applyDefaultInfoValues, "applyDefaultInfoValues");
9388
+ function buildMethodDisplays(params) {
9389
+ const { context, source, lib, libMethod, colorize } = params;
9390
+ let sourceDisplay = "";
9391
+ let libMethodDisplay = "";
9392
+ if (source) {
9393
+ sourceDisplay = `[${colorize(source)}]`;
9394
+ }
9395
+ if (lib) {
9396
+ const methodPath = libMethod ? `${context}.${libMethod}` : context;
9397
+ libMethodDisplay = `[${colorize(methodPath)}]`;
9398
+ if (source === context || source === methodPath) {
9399
+ sourceDisplay = "";
9400
+ }
9401
+ return {
9402
+ sourceDisplay,
9403
+ libMethodDisplay
9404
+ };
9405
+ }
9406
+ if (!source) {
9407
+ libMethodDisplay = `[${colorize(context)}]`;
9408
+ return {
9409
+ sourceDisplay,
9410
+ libMethodDisplay
9411
+ };
9412
+ }
9413
+ if (source.startsWith(`${context}.`) || source === context) {
9414
+ libMethodDisplay = `[${colorize(source)}]`;
9415
+ sourceDisplay = "";
9416
+ return {
9417
+ sourceDisplay,
9418
+ libMethodDisplay
9419
+ };
9420
+ }
9421
+ libMethodDisplay = `[${colorize(context)}]`;
9422
+ sourceDisplay = `[${colorize(source)}]`;
9423
+ return {
9424
+ sourceDisplay,
9425
+ libMethodDisplay
9426
+ };
9427
+ }
9428
+ __name(buildMethodDisplays, "buildMethodDisplays");
9429
+ function formatDevelopmentLog(infoInput, useColors, levelColorizer) {
9430
+ const info = infoInput;
9431
+ const level = asString(info.level) ?? "info";
9432
+ const message = asString(info.message) ?? "";
9433
+ const timestamp = asString(info.timestamp) ?? "";
9434
+ const requestId = asString(info.requestId) ?? "no-request-id";
9435
+ const context = asString(info.context) ?? "App";
9436
+ const source = asString(info.source);
9437
+ const appName = asString(info.appName);
9438
+ const appVersion = asString(info.appVersion);
9439
+ const lib = asString(info.lib);
9440
+ const libMethod = asString(info.libMethod);
9441
+ const libVersion = asString(info.libVersion);
9442
+ const stack = asString(info.stack);
9443
+ const meta = info.meta && typeof info.meta === "object" ? info.meta : void 0;
9444
+ const colors = {
9445
+ reset: "\x1B[0m",
9446
+ gray: "\x1B[90m",
9447
+ cyan: "\x1B[36m",
9448
+ magenta: "\x1B[35m",
9449
+ yellow: "\x1B[33m",
9450
+ red: "\x1B[31m",
9451
+ green: "\x1B[32m"
9452
+ };
9453
+ const coloredLevel = useColors ? levelColorizer.colorize(level, level.toUpperCase()) : level.toUpperCase();
9454
+ const coloredTime = colorizeText(useColors, colors.gray, colors.reset, timestamp);
9455
+ const coloredRequestId = colorizeText(useColors, colors.cyan, colors.reset, requestId);
9456
+ let appDisplay = "";
9457
+ if (appName) {
9458
+ const appText = appVersion ? `${appName}@${appVersion}` : appName;
9459
+ const appLabel = `App-${appText}`;
9460
+ appDisplay = `[${colorizeText(useColors, colors.green, colors.reset, appLabel)}]`;
9461
+ }
9462
+ let libDisplay = "";
9463
+ if (lib) {
9464
+ const libText = libVersion ? `${lib}:${libVersion}` : lib;
9465
+ libDisplay = `[${colorizeText(useColors, colors.yellow, colors.reset, libText)}]`;
9466
+ }
9467
+ const { sourceDisplay, libMethodDisplay } = buildMethodDisplays({
9468
+ context,
9469
+ source,
9470
+ lib,
9471
+ libMethod,
9472
+ colorize: /* @__PURE__ */ __name((text) => colorizeText(useColors, colors.magenta, colors.reset, text), "colorize")
9473
+ });
9474
+ let output = `${appDisplay}${libDisplay}[${coloredRequestId}][${coloredTime}]${sourceDisplay}${libMethodDisplay}[${coloredLevel}] - ${message}`;
9475
+ if (meta && typeof meta === "object" && Object.keys(meta).length > 0) {
9476
+ const inspectedMeta = (0, import_node_util.inspect)(meta, {
9477
+ colors: useColors,
9478
+ depth: null,
9479
+ compact: true,
9480
+ sorted: true,
9481
+ breakLength: Infinity
9482
+ });
9483
+ output += ` - ${inspectedMeta}`;
9484
+ }
9485
+ if (stack) {
9486
+ output += `
9487
+ ${colorizeText(useColors, colors.red, colors.reset, stack)}`;
9488
+ }
9489
+ return output;
9490
+ }
9491
+ __name(formatDevelopmentLog, "formatDevelopmentLog");
9332
9492
  var WinstonImplementationModule = class _WinstonImplementationModule {
9333
9493
  static {
9334
9494
  __name(this, "WinstonImplementationModule");
@@ -9403,124 +9563,13 @@ var WinstonImplementationModule = class _WinstonImplementationModule {
9403
9563
  const isProduction = config?.isProduction ?? process.env.NODE_ENV === "production";
9404
9564
  const useColors = config?.colorize !== false;
9405
9565
  const standardFields = (0, import_winston2.format)((info) => {
9406
- const meta = info.meta;
9407
- if (meta) {
9408
- if (meta.requestId && !info.requestId) {
9409
- info.requestId = meta.requestId;
9410
- delete meta.requestId;
9411
- }
9412
- if (meta.context && !info.context) {
9413
- info.context = meta.context;
9414
- delete meta.context;
9415
- }
9416
- if (meta.source && !info.source) {
9417
- info.source = meta.source;
9418
- delete meta.source;
9419
- }
9420
- if (meta.lib && !info.lib) {
9421
- info.lib = meta.lib;
9422
- delete meta.lib;
9423
- }
9424
- if (meta.libVersion && !info.libVersion) {
9425
- info.libVersion = meta.libVersion;
9426
- delete meta.libVersion;
9427
- }
9428
- if (meta.libMethod && !info.libMethod) {
9429
- info.libMethod = meta.libMethod;
9430
- delete meta.libMethod;
9431
- }
9432
- if (meta.appName && !info.appName) {
9433
- info.appName = meta.appName;
9434
- delete meta.appName;
9435
- }
9436
- if (meta.appVersion && !info.appVersion) {
9437
- info.appVersion = meta.appVersion;
9438
- delete meta.appVersion;
9439
- }
9440
- if (meta.logContext && !info.source) {
9441
- const lc = meta.logContext;
9442
- if (lc.className && lc.methodName) {
9443
- info.source = `${lc.className}.${lc.methodName}`;
9444
- } else if (lc.className) {
9445
- info.source = lc.className;
9446
- } else if (lc.methodName) {
9447
- info.source = lc.methodName;
9448
- }
9449
- }
9450
- }
9451
- info.requestId = info.requestId || "no-request-id";
9452
- info.context = info.context || config?.context || "App";
9453
- info.appName = info.appName || config?.appName;
9454
- info.appVersion = info.appVersion || config?.appVersion;
9455
- info.lib = info.lib || config?.lib;
9456
- info.libVersion = info.libVersion || config?.libVersion;
9457
- return info;
9566
+ const writableInfo = info;
9567
+ fillInfoFromMeta(writableInfo);
9568
+ applyDefaultInfoValues(writableInfo, config);
9569
+ return writableInfo;
9458
9570
  });
9459
9571
  const levelColorizer = import_winston2.format.colorize();
9460
- const developmentFormat = import_winston2.format.printf((info) => {
9461
- const { level, message, timestamp, requestId, context, source, meta, stack, appName, appVersion, lib, libMethod, libVersion } = info;
9462
- const colors = {
9463
- reset: "\x1B[0m",
9464
- gray: "\x1B[90m",
9465
- cyan: "\x1B[36m",
9466
- magenta: "\x1B[35m",
9467
- yellow: "\x1B[33m",
9468
- red: "\x1B[31m",
9469
- green: "\x1B[32m",
9470
- bold: "\x1B[1m"
9471
- };
9472
- const colorize = /* @__PURE__ */ __name((color, text) => useColors ? `${color}${text}${colors.reset}` : text, "colorize");
9473
- const coloredLevel = useColors ? levelColorizer.colorize(level, level.toUpperCase()) : level.toUpperCase();
9474
- const coloredTime = colorize(colors.gray, timestamp);
9475
- const coloredRequestId = colorize(colors.cyan, requestId);
9476
- let appDisplay = "";
9477
- if (appName) {
9478
- const appText = appVersion ? `${appName}@${appVersion}` : appName;
9479
- appDisplay = `[${colorize(colors.green, `App-${appText}`)}]`;
9480
- }
9481
- let libDisplay = "";
9482
- if (lib) {
9483
- const libText = libVersion ? `${lib}:${libVersion}` : lib;
9484
- libDisplay = `[${colorize(colors.yellow, libText)}]`;
9485
- }
9486
- const mag = colors.magenta;
9487
- let sourceDisplay = "";
9488
- let libMethodDisplay = "";
9489
- if (source) {
9490
- sourceDisplay = `[${colorize(mag, source)}]`;
9491
- }
9492
- if (lib) {
9493
- const methodPath = libMethod ? `${context}.${libMethod}` : context;
9494
- libMethodDisplay = `[${colorize(mag, methodPath)}]`;
9495
- if (source === context || source === methodPath) {
9496
- sourceDisplay = "";
9497
- }
9498
- } else if (!source) {
9499
- libMethodDisplay = `[${colorize(mag, context)}]`;
9500
- } else if (source.startsWith(`${context}.`) || source === context) {
9501
- libMethodDisplay = `[${colorize(mag, source)}]`;
9502
- sourceDisplay = "";
9503
- } else {
9504
- libMethodDisplay = `[${colorize(mag, context)}]`;
9505
- sourceDisplay = `[${colorize(mag, source)}]`;
9506
- }
9507
- let output = `${appDisplay}${libDisplay}[${coloredRequestId}][${coloredTime}]${sourceDisplay}${libMethodDisplay}[${coloredLevel}] - ${message}`;
9508
- if (meta && typeof meta === "object" && Object.keys(meta).length > 0) {
9509
- const inspectedMeta = (0, import_util.inspect)(meta, {
9510
- colors: useColors,
9511
- depth: null,
9512
- compact: true,
9513
- sorted: true,
9514
- breakLength: Infinity
9515
- });
9516
- output += ` - ${inspectedMeta}`;
9517
- }
9518
- if (stack) {
9519
- output += `
9520
- ${colorize(colors.red, stack)}`;
9521
- }
9522
- return output;
9523
- });
9572
+ const developmentFormat = import_winston2.format.printf((info) => formatDevelopmentLog(info, useColors, levelColorizer));
9524
9573
  const formats = [
9525
9574
  import_winston2.format.timestamp(),
9526
9575
  import_winston2.format.errors({
@@ -9545,7 +9594,10 @@ ${colorize(colors.red, stack)}`;
9545
9594
  consoleTransport
9546
9595
  ]
9547
9596
  };
9548
- const mergedOptions = Object.assign({}, defaultOptions, config?.loggerOptions || {});
9597
+ const mergedOptions = config?.loggerOptions ? {
9598
+ ...defaultOptions,
9599
+ ...config.loggerOptions
9600
+ } : defaultOptions;
9549
9601
  return (0, import_winston2.createLogger)(mergedOptions);
9550
9602
  }
9551
9603
  };
@@ -9554,7 +9606,8 @@ WinstonImplementationModule = _ts_decorate3([
9554
9606
  ], WinstonImplementationModule);
9555
9607
 
9556
9608
  // src/interceptors/http-logging.interceptor.ts
9557
- var import_common4 = require("@nestjs/common");
9609
+ var import_common5 = require("@nestjs/common");
9610
+ var import_core = require("@nestjs/core");
9558
9611
  var import_operators = __toESM(require_operators());
9559
9612
 
9560
9613
  // src/interceptors/http-logging.interceptor.constant.ts
@@ -9564,6 +9617,11 @@ var HTTP_LOGGING_INTERCEPTOR_CONTEXT = {
9564
9617
  ON_ERROR: "HttpLoggingInterceptor.onError"
9565
9618
  };
9566
9619
 
9620
+ // src/interceptors/exclude-http-logging.decorator.ts
9621
+ var import_common4 = require("@nestjs/common");
9622
+ var EXCLUDE_HTTP_LOGGING_KEY = "EXCLUDE_HTTP_LOGGING";
9623
+ var ExcludeHttpLogging = /* @__PURE__ */ __name(() => (0, import_common4.SetMetadata)(EXCLUDE_HTTP_LOGGING_KEY, true), "ExcludeHttpLogging");
9624
+
9567
9625
  // src/interceptors/http-logging.interceptor.ts
9568
9626
  function _ts_decorate4(decorators, target, key, desc) {
9569
9627
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -9587,14 +9645,38 @@ var HttpLoggingInterceptor = class {
9587
9645
  __name(this, "HttpLoggingInterceptor");
9588
9646
  }
9589
9647
  logger;
9590
- constructor(logger) {
9648
+ reflector;
9649
+ excludedPaths;
9650
+ toErrorMessage(error) {
9651
+ if (error instanceof Error) return error.message;
9652
+ if (typeof error === "string") return error;
9653
+ try {
9654
+ return JSON.stringify(error);
9655
+ } catch {
9656
+ return "unknown error";
9657
+ }
9658
+ }
9659
+ constructor(logger, reflector, config) {
9591
9660
  this.logger = logger;
9661
+ this.reflector = reflector;
9662
+ this.excludedPaths = config?.interceptorExcludedPaths ?? [];
9663
+ }
9664
+ isExcluded(url) {
9665
+ const normalized = url.replace(/^\/v\d+/, "");
9666
+ return this.excludedPaths.some((path) => normalized === path || normalized.startsWith(path + "/"));
9592
9667
  }
9593
9668
  intercept(context, next) {
9594
9669
  const http = context.switchToHttp();
9595
9670
  const request = http.getRequest();
9596
9671
  const response = http.getResponse();
9597
9672
  const start = Date.now();
9673
+ const isDecoratorExcluded = this.reflector.getAllAndOverride(EXCLUDE_HTTP_LOGGING_KEY, [
9674
+ context.getHandler(),
9675
+ context.getClass()
9676
+ ]);
9677
+ if (isDecoratorExcluded || this.isExcluded(request.url)) {
9678
+ return next.handle();
9679
+ }
9598
9680
  const { method, url, headers, body, query, params } = request;
9599
9681
  this.logger.info({
9600
9682
  message: "HTTP Request",
@@ -9642,7 +9724,7 @@ var HttpLoggingInterceptor = class {
9642
9724
  },
9643
9725
  response: {
9644
9726
  durationMs,
9645
- error: error instanceof Error ? error.message : String(error)
9727
+ error: this.toErrorMessage(error)
9646
9728
  }
9647
9729
  }
9648
9730
  });
@@ -9651,11 +9733,15 @@ var HttpLoggingInterceptor = class {
9651
9733
  }
9652
9734
  };
9653
9735
  HttpLoggingInterceptor = _ts_decorate4([
9654
- (0, import_common4.Injectable)(),
9655
- _ts_param3(0, (0, import_common4.Inject)(LOGGER_PROVIDER)),
9736
+ (0, import_common5.Injectable)(),
9737
+ _ts_param3(0, (0, import_common5.Inject)(LOGGER_PROVIDER)),
9738
+ _ts_param3(2, (0, import_common5.Optional)()),
9739
+ _ts_param3(2, (0, import_common5.Inject)(LOGGER_CONFIG)),
9656
9740
  _ts_metadata3("design:type", Function),
9657
9741
  _ts_metadata3("design:paramtypes", [
9658
- typeof LoggerProviderInterface === "undefined" ? Object : LoggerProviderInterface
9742
+ typeof LoggerProviderInterface === "undefined" ? Object : LoggerProviderInterface,
9743
+ typeof import_core.Reflector === "undefined" ? Object : import_core.Reflector,
9744
+ typeof LoggerConfig === "undefined" ? Object : LoggerConfig
9659
9745
  ])
9660
9746
  ], HttpLoggingInterceptor);
9661
9747
 
@@ -9682,7 +9768,7 @@ var LoggerModule = class _LoggerModule {
9682
9768
  useClass: LoggerProvider
9683
9769
  };
9684
9770
  if (config && config.requestScoped) {
9685
- loggerProvider.scope = import_common5.Scope.REQUEST;
9771
+ loggerProvider.scope = import_common6.Scope.REQUEST;
9686
9772
  }
9687
9773
  return {
9688
9774
  module: _LoggerModule,
@@ -9690,11 +9776,16 @@ var LoggerModule = class _LoggerModule {
9690
9776
  implModule
9691
9777
  ],
9692
9778
  providers: [
9779
+ {
9780
+ provide: LOGGER_CONFIG,
9781
+ useValue: config ?? {}
9782
+ },
9693
9783
  loggerProvider,
9694
9784
  httpLoggingInterceptorProvider
9695
9785
  ],
9696
9786
  exports: [
9697
9787
  LOGGER_PROVIDER,
9788
+ LOGGER_CONFIG,
9698
9789
  HTTP_LOGGING_INTERCEPTOR
9699
9790
  ]
9700
9791
  };
@@ -9707,6 +9798,11 @@ var LoggerModule = class _LoggerModule {
9707
9798
  WinstonImplementationModule.forRootAsync(options)
9708
9799
  ],
9709
9800
  providers: [
9801
+ {
9802
+ provide: LOGGER_CONFIG,
9803
+ useFactory: options.useFactory,
9804
+ inject: options.inject || []
9805
+ },
9710
9806
  {
9711
9807
  provide: LOGGER_PROVIDER,
9712
9808
  useClass: LoggerProvider
@@ -9715,18 +9811,19 @@ var LoggerModule = class _LoggerModule {
9715
9811
  ],
9716
9812
  exports: [
9717
9813
  LOGGER_PROVIDER,
9814
+ LOGGER_CONFIG,
9718
9815
  HTTP_LOGGING_INTERCEPTOR
9719
9816
  ]
9720
9817
  };
9721
9818
  }
9722
9819
  };
9723
9820
  LoggerModule = _ts_decorate5([
9724
- (0, import_common5.Global)(),
9725
- (0, import_common5.Module)({})
9821
+ (0, import_common6.Global)(),
9822
+ (0, import_common6.Module)({})
9726
9823
  ], LoggerModule);
9727
9824
 
9728
9825
  // src/middleware/request-context.middleware.ts
9729
- var import_common6 = require("@nestjs/common");
9826
+ var import_common7 = require("@nestjs/common");
9730
9827
  var import_crypto = require("crypto");
9731
9828
 
9732
9829
  // src/request-id.constants.ts
@@ -9760,7 +9857,7 @@ var RequestContextMiddleware = class {
9760
9857
  }
9761
9858
  };
9762
9859
  RequestContextMiddleware = _ts_decorate6([
9763
- (0, import_common6.Injectable)()
9860
+ (0, import_common7.Injectable)()
9764
9861
  ], RequestContextMiddleware);
9765
9862
 
9766
9863
  // src/logger.config.ts
@@ -9772,9 +9869,11 @@ var DEFAULT_LOGGER_CONFIG = {
9772
9869
  // Annotate the CommonJS export names for ESM import in node:
9773
9870
  0 && (module.exports = {
9774
9871
  DEFAULT_LOGGER_CONFIG,
9872
+ ExcludeHttpLogging,
9775
9873
  HTTP_LOGGING_INTERCEPTOR,
9776
9874
  HTTP_LOGGING_INTERCEPTOR_CONTEXT,
9777
9875
  HttpLoggingInterceptor,
9876
+ LOGGER_CONFIG,
9778
9877
  LOGGER_PROVIDER,
9779
9878
  LoggerModule,
9780
9879
  RequestContextMiddleware,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/logger",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,4 +1,4 @@
1
- import { AsyncLocalStorage } from "async_hooks";
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { RequestContext } from "./async-context.types";
3
3
 
4
4
  export const asyncLocalStorage = new AsyncLocalStorage<