@rsdk/logging 5.10.1-next.0 → 5.10.1-next.1

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/src/types.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Constructor } from '@rsdk/common';
2
2
  import type pino from 'pino';
3
+ import type { TransportMultiOptions } from 'pino';
3
4
 
4
5
  export enum LogLevel {
5
6
  fatal = 'fatal',
@@ -10,17 +11,41 @@ export enum LogLevel {
10
11
  trace = 'trace',
11
12
  }
12
13
 
14
+ export enum LogTimestampFormat {
15
+ epochTime = 'epochTime',
16
+ unixTime = 'unixTime',
17
+ nullTime = 'nullTime',
18
+ isoTime = 'isoTime',
19
+ }
20
+
21
+ export type TimeFn = () => string;
22
+
13
23
  export type Params = Record<string, unknown>;
14
24
 
15
- export interface LoggerOptions {
25
+ export interface LoggerOptionsBase {
16
26
  level: LogLevel;
17
27
  redact: string[];
18
- stream: pino.DestinationStream;
28
+ timestampFormat: LogTimestampFormat;
19
29
  }
20
30
 
31
+ /**
32
+ * `stream` и `transport` — взаимоисключающие способы доставки (pino не
33
+ * принимает оба сразу). Это закодировано в типе: задание одного запрещает
34
+ * другой.
35
+ */
36
+ export type LoggerOptions = LoggerOptionsBase &
37
+ (
38
+ | { stream?: pino.DestinationStream; transport?: never }
39
+ | { stream?: never; transport?: TransportMultiOptions }
40
+ );
41
+
21
42
  export type LoggingContext = string | Constructor;
22
43
 
23
44
  export type OnMessage = (
24
45
  level: LogLevel,
25
46
  data: Record<string, unknown>,
26
47
  ) => void;
48
+
49
+ export interface LoggerSerializerMetadata {
50
+ target: Constructor;
51
+ }