nestjs-log-decorator 1.1.0 → 1.2.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.
package/dist/index.cjs CHANGED
@@ -438,5 +438,10 @@ const NoLog = () => {
438
438
 
439
439
  //#endregion
440
440
  exports.Log = Log;
441
+ exports.LogWrapper = LogWrapper;
442
+ exports.NO_LOG_METADATA_KEY = NO_LOG_METADATA_KEY;
441
443
  exports.NoLog = NoLog;
442
- exports.isLoggable = isLoggable;
444
+ exports.buildArgsObject = buildArgsObject;
445
+ exports.createLogWrapper = createLogWrapper;
446
+ exports.isLoggable = isLoggable;
447
+ exports.prettifyAxiosError = prettifyAxiosError;
package/dist/index.d.cts CHANGED
@@ -29,14 +29,53 @@ interface LogOptions<TArgs extends unknown[] = unknown[]> {
29
29
  */
30
30
  args?: LogArgsFormatter<TArgs>;
31
31
  }
32
+ /**
33
+ * Symbol used to mark methods that should not be logged
34
+ * @internal
35
+ */
36
+ declare const NO_LOG_METADATA_KEY: unique symbol;
32
37
  //#endregion
33
38
  //#region src/LogWrapper.d.ts
34
-
39
+ /**
40
+ * Wrapper class for logging operations with consistent format.
41
+ * @internal
42
+ */
43
+ declare class LogWrapper {
44
+ private readonly logger;
45
+ private readonly method;
46
+ private readonly args;
47
+ constructor(logger: Logger, method: string, args: string | number | Record<string, unknown> | undefined);
48
+ invoked(): void;
49
+ success(): void;
50
+ error(error: unknown): void;
51
+ }
35
52
  /** If you see it, then you probably forgot to add `readonly logger = new Logger(YourClass.name)` to your class */
36
53
  interface Loggable {
37
54
  logger: Logger;
38
55
  }
39
56
  declare const isLoggable: (instance: unknown) => instance is Loggable;
57
+ /**
58
+ * Creates a LogWrapper instance with validated logger and built args object.
59
+ * @internal
60
+ */
61
+ declare const createLogWrapper: (instance: unknown, className: string, methodName: string, argsObject: string | number | Record<string, unknown> | undefined) => LogWrapper;
62
+ /**
63
+ * Builds an object mapping parameter names to their values.
64
+ *
65
+ * Creates a record where keys are parameter names and values are the
66
+ * corresponding argument values passed to the function.
67
+ *
68
+ * @param parameterNames - Array of parameter names
69
+ * @param args - Array of argument values
70
+ * @returns Object mapping parameter names to values
71
+ *
72
+ * @example
73
+ * buildArgsObject(['id', 'name'], [1, 'John'])
74
+ * // Returns: { id: 1, name: 'John' }
75
+ *
76
+ * @internal
77
+ */
78
+ declare const buildArgsObject: (parameterNames: string[], args: unknown[]) => Record<string, unknown> | undefined;
40
79
  //#endregion
41
80
  //#region src/log.decorator.d.ts
42
81
  type LoggableConstructor = new (...args: any[]) => Loggable;
@@ -250,4 +289,7 @@ declare const Log: <TArgs extends unknown[]>(options?: LogOptions<TArgs>) => Log
250
289
  */
251
290
  declare const NoLog: () => (_target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
252
291
  //#endregion
253
- export { Log, type LogArgsFormatter, type LogOptions, type Loggable, NoLog, isLoggable };
292
+ //#region src/axios/axios.logger.d.ts
293
+ declare function prettifyAxiosError(error: unknown): unknown;
294
+ //#endregion
295
+ export { Log, LogArgsFormatter, LogOptions, LogWrapper, Loggable, NO_LOG_METADATA_KEY, NoLog, buildArgsObject, createLogWrapper, isLoggable, prettifyAxiosError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestjs-log-decorator",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Decorator that removes try catch boilerplate logging from NestJS service methods",
5
5
  "author": "Vlad Goncharov <leovs010@gmail.com>",
6
6
  "license": "AGPL-3.0",