fixparser-plugin-log-console 9.1.7-af630b11 → 9.1.7-b8fd1147

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.
@@ -29,7 +29,7 @@ var ConsoleLogTransport = class {
29
29
  this.format = format;
30
30
  }
31
31
  /**
32
- * Configures the format for console logging (either 'console' for text or 'json').
32
+ * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').
33
33
  */
34
34
  configure(config) {
35
35
  this.format = config.format || "json";
@@ -39,6 +39,19 @@ var ConsoleLogTransport = class {
39
39
  */
40
40
  async send(log) {
41
41
  if (this.format === "json") {
42
+ console.log(JSON.stringify(log));
43
+ } else if (this.format === "jsonrpc") {
44
+ const { message, ...rest } = log;
45
+ const jsonrpcMessage = {
46
+ jsonrpc: "2.0",
47
+ method: log.level,
48
+ params: {
49
+ message,
50
+ ...rest
51
+ },
52
+ id: log.id || Date.now()
53
+ };
54
+ console.log(JSON.stringify(jsonrpcMessage));
42
55
  } else {
43
56
  const { name, id, message, level, ...additionalProperties } = log;
44
57
  const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);
@@ -48,6 +61,7 @@ var ConsoleLogTransport = class {
48
61
  }
49
62
  logMessage += `${id}: ${message}`;
50
63
  void kv;
64
+ console.log(logMessage, kv.join(", "));
51
65
  }
52
66
  }
53
67
  /**
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ConsoleLogTransport.ts"],
4
- "sourcesContent": ["import type { ILogTransporter, LogMessage } from 'fixparser-common';\n\n/**\n * Logger output format options.\n *\n * - 'console': Output log in plain text format\n * - 'json': Output log in JSON format\n *\n * @public\n */\nexport type ConsoleFormat = 'console' | 'json';\n\n/**\n * A LogTransporter implementation for logging to the console.\n * It supports both text (console) and JSON formats.\n */\nexport class ConsoleLogTransport implements ILogTransporter {\n private format: ConsoleFormat;\n\n constructor({ format = 'json' }: { format: ConsoleFormat }) {\n this.format = format;\n }\n\n /**\n * Configures the format for console logging (either 'console' for text or 'json').\n */\n configure(config: { format: 'console' | 'json' }): void {\n this.format = config.format || 'json';\n }\n\n /**\n * Sends the log message to the console in the configured format.\n */\n async send(log: LogMessage): Promise<void> {\n if (this.format === 'json') {\n //console.log(JSON.stringify(log)); // TODO RE-ENABLE\n } else {\n const { name, id, message, level, ...additionalProperties } = log;\n const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);\n let logMessage = '';\n if (name) {\n logMessage += `${name} `;\n }\n logMessage += `${id}: ${message}`;\n void kv;\n //console.log(logMessage, kv.join(', ')); // TODO RE-ENABLE\n }\n }\n\n /**\n * Flushes the log buffer (if any buffering mechanism exists).\n */\n async flush(): Promise<void> {\n // No flushing needed for console transport\n }\n\n /**\n * Closes the transport (not needed for console, but keeping the method for consistency).\n */\n async close(): Promise<void> {\n // No close logic needed for console transport\n }\n\n /**\n * Returns the status of the transport (always \"connected\" for console).\n */\n status(): string {\n return 'connected';\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,IAAM,sBAAN,MAAqD;AAAA,EAChD;AAAA,EAER,YAAY,EAAE,SAAS,OAAO,GAA8B;AACxD,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,QAA8C;AACpD,SAAK,SAAS,OAAO,UAAU;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,KAAgC;AACvC,QAAI,KAAK,WAAW,QAAQ;AAAA,IAE5B,OAAO;AACH,YAAM,EAAE,MAAM,IAAI,SAAS,OAAO,GAAG,qBAAqB,IAAI;AAC9D,YAAM,KAAK,OAAO,QAAQ,oBAAoB,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,GAAG,GAAG,KAAK,KAAK,EAAE;AACxF,UAAI,aAAa;AACjB,UAAI,MAAM;AACN,sBAAc,GAAG,IAAI;AAAA,MACzB;AACA,oBAAc,GAAG,EAAE,KAAK,OAAO;AAC/B,WAAK;AAAA,IAET;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,SAAiB;AACb,WAAO;AAAA,EACX;AACJ;",
4
+ "sourcesContent": ["import type { ILogTransporter, LogMessage } from 'fixparser-common';\n\n/**\n * Logger output format options.\n *\n * - 'console': Output log in plain text format\n * - 'json': Output log in JSON format\n * - 'jsonrpc': Output log in JSON-RPC 2.0 format\n *\n * @public\n */\nexport type ConsoleFormat = 'console' | 'json' | 'jsonrpc';\n\n/**\n * A LogTransporter implementation for logging to the console.\n * It supports text (console), JSON, and JSON-RPC 2.0 formats.\n */\nexport class ConsoleLogTransport implements ILogTransporter {\n private format: ConsoleFormat;\n\n constructor({ format = 'json' }: { format: ConsoleFormat }) {\n this.format = format;\n }\n\n /**\n * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').\n */\n configure(config: { format: 'console' | 'json' | 'jsonrpc' }): void {\n this.format = config.format || 'json';\n }\n\n /**\n * Sends the log message to the console in the configured format.\n */\n async send(log: LogMessage): Promise<void> {\n if (this.format === 'json') {\n console.log(JSON.stringify(log));\n } else if (this.format === 'jsonrpc') {\n const { message, ...rest } = log;\n const jsonrpcMessage = {\n jsonrpc: '2.0',\n method: log.level,\n params: {\n message,\n ...rest,\n },\n id: log.id || Date.now(),\n };\n console.log(JSON.stringify(jsonrpcMessage));\n } else {\n const { name, id, message, level, ...additionalProperties } = log;\n const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);\n let logMessage = '';\n if (name) {\n logMessage += `${name} `;\n }\n logMessage += `${id}: ${message}`;\n void kv;\n console.log(logMessage, kv.join(', '));\n }\n }\n\n /**\n * Flushes the log buffer (if any buffering mechanism exists).\n */\n async flush(): Promise<void> {\n // No flushing needed for console transport\n }\n\n /**\n * Closes the transport (not needed for console, but keeping the method for consistency).\n */\n async close(): Promise<void> {\n // No close logic needed for console transport\n }\n\n /**\n * Returns the status of the transport (always \"connected\" for console).\n */\n status(): string {\n return 'connected';\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,sBAAN,MAAqD;AAAA,EAChD;AAAA,EAER,YAAY,EAAE,SAAS,OAAO,GAA8B;AACxD,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,QAA0D;AAChE,SAAK,SAAS,OAAO,UAAU;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,KAAgC;AACvC,QAAI,KAAK,WAAW,QAAQ;AACxB,cAAQ,IAAI,KAAK,UAAU,GAAG,CAAC;AAAA,IACnC,WAAW,KAAK,WAAW,WAAW;AAClC,YAAM,EAAE,SAAS,GAAG,KAAK,IAAI;AAC7B,YAAM,iBAAiB;AAAA,QACnB,SAAS;AAAA,QACT,QAAQ,IAAI;AAAA,QACZ,QAAQ;AAAA,UACJ;AAAA,UACA,GAAG;AAAA,QACP;AAAA,QACA,IAAI,IAAI,MAAM,KAAK,IAAI;AAAA,MAC3B;AACA,cAAQ,IAAI,KAAK,UAAU,cAAc,CAAC;AAAA,IAC9C,OAAO;AACH,YAAM,EAAE,MAAM,IAAI,SAAS,OAAO,GAAG,qBAAqB,IAAI;AAC9D,YAAM,KAAK,OAAO,QAAQ,oBAAoB,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,GAAG,GAAG,KAAK,KAAK,EAAE;AACxF,UAAI,aAAa;AACjB,UAAI,MAAM;AACN,sBAAc,GAAG,IAAI;AAAA,MACzB;AACA,oBAAc,GAAG,EAAE,KAAK,OAAO;AAC/B,WAAK;AACL,cAAQ,IAAI,YAAY,GAAG,KAAK,IAAI,CAAC;AAAA,IACzC;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,SAAiB;AACb,WAAO;AAAA,EACX;AACJ;",
6
6
  "names": []
7
7
  }
@@ -5,7 +5,7 @@ var ConsoleLogTransport = class {
5
5
  this.format = format;
6
6
  }
7
7
  /**
8
- * Configures the format for console logging (either 'console' for text or 'json').
8
+ * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').
9
9
  */
10
10
  configure(config) {
11
11
  this.format = config.format || "json";
@@ -15,6 +15,19 @@ var ConsoleLogTransport = class {
15
15
  */
16
16
  async send(log) {
17
17
  if (this.format === "json") {
18
+ console.log(JSON.stringify(log));
19
+ } else if (this.format === "jsonrpc") {
20
+ const { message, ...rest } = log;
21
+ const jsonrpcMessage = {
22
+ jsonrpc: "2.0",
23
+ method: log.level,
24
+ params: {
25
+ message,
26
+ ...rest
27
+ },
28
+ id: log.id || Date.now()
29
+ };
30
+ console.log(JSON.stringify(jsonrpcMessage));
18
31
  } else {
19
32
  const { name, id, message, level, ...additionalProperties } = log;
20
33
  const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);
@@ -24,6 +37,7 @@ var ConsoleLogTransport = class {
24
37
  }
25
38
  logMessage += `${id}: ${message}`;
26
39
  void kv;
40
+ console.log(logMessage, kv.join(", "));
27
41
  }
28
42
  }
29
43
  /**
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ConsoleLogTransport.ts"],
4
- "sourcesContent": ["import type { ILogTransporter, LogMessage } from 'fixparser-common';\n\n/**\n * Logger output format options.\n *\n * - 'console': Output log in plain text format\n * - 'json': Output log in JSON format\n *\n * @public\n */\nexport type ConsoleFormat = 'console' | 'json';\n\n/**\n * A LogTransporter implementation for logging to the console.\n * It supports both text (console) and JSON formats.\n */\nexport class ConsoleLogTransport implements ILogTransporter {\n private format: ConsoleFormat;\n\n constructor({ format = 'json' }: { format: ConsoleFormat }) {\n this.format = format;\n }\n\n /**\n * Configures the format for console logging (either 'console' for text or 'json').\n */\n configure(config: { format: 'console' | 'json' }): void {\n this.format = config.format || 'json';\n }\n\n /**\n * Sends the log message to the console in the configured format.\n */\n async send(log: LogMessage): Promise<void> {\n if (this.format === 'json') {\n //console.log(JSON.stringify(log)); // TODO RE-ENABLE\n } else {\n const { name, id, message, level, ...additionalProperties } = log;\n const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);\n let logMessage = '';\n if (name) {\n logMessage += `${name} `;\n }\n logMessage += `${id}: ${message}`;\n void kv;\n //console.log(logMessage, kv.join(', ')); // TODO RE-ENABLE\n }\n }\n\n /**\n * Flushes the log buffer (if any buffering mechanism exists).\n */\n async flush(): Promise<void> {\n // No flushing needed for console transport\n }\n\n /**\n * Closes the transport (not needed for console, but keeping the method for consistency).\n */\n async close(): Promise<void> {\n // No close logic needed for console transport\n }\n\n /**\n * Returns the status of the transport (always \"connected\" for console).\n */\n status(): string {\n return 'connected';\n }\n}\n"],
5
- "mappings": ";AAgBO,IAAM,sBAAN,MAAqD;AAAA,EAChD;AAAA,EAER,YAAY,EAAE,SAAS,OAAO,GAA8B;AACxD,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,QAA8C;AACpD,SAAK,SAAS,OAAO,UAAU;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,KAAgC;AACvC,QAAI,KAAK,WAAW,QAAQ;AAAA,IAE5B,OAAO;AACH,YAAM,EAAE,MAAM,IAAI,SAAS,OAAO,GAAG,qBAAqB,IAAI;AAC9D,YAAM,KAAK,OAAO,QAAQ,oBAAoB,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,GAAG,GAAG,KAAK,KAAK,EAAE;AACxF,UAAI,aAAa;AACjB,UAAI,MAAM;AACN,sBAAc,GAAG,IAAI;AAAA,MACzB;AACA,oBAAc,GAAG,EAAE,KAAK,OAAO;AAC/B,WAAK;AAAA,IAET;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,SAAiB;AACb,WAAO;AAAA,EACX;AACJ;",
4
+ "sourcesContent": ["import type { ILogTransporter, LogMessage } from 'fixparser-common';\n\n/**\n * Logger output format options.\n *\n * - 'console': Output log in plain text format\n * - 'json': Output log in JSON format\n * - 'jsonrpc': Output log in JSON-RPC 2.0 format\n *\n * @public\n */\nexport type ConsoleFormat = 'console' | 'json' | 'jsonrpc';\n\n/**\n * A LogTransporter implementation for logging to the console.\n * It supports text (console), JSON, and JSON-RPC 2.0 formats.\n */\nexport class ConsoleLogTransport implements ILogTransporter {\n private format: ConsoleFormat;\n\n constructor({ format = 'json' }: { format: ConsoleFormat }) {\n this.format = format;\n }\n\n /**\n * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').\n */\n configure(config: { format: 'console' | 'json' | 'jsonrpc' }): void {\n this.format = config.format || 'json';\n }\n\n /**\n * Sends the log message to the console in the configured format.\n */\n async send(log: LogMessage): Promise<void> {\n if (this.format === 'json') {\n console.log(JSON.stringify(log));\n } else if (this.format === 'jsonrpc') {\n const { message, ...rest } = log;\n const jsonrpcMessage = {\n jsonrpc: '2.0',\n method: log.level,\n params: {\n message,\n ...rest,\n },\n id: log.id || Date.now(),\n };\n console.log(JSON.stringify(jsonrpcMessage));\n } else {\n const { name, id, message, level, ...additionalProperties } = log;\n const kv = Object.entries(additionalProperties).map(([key, value]) => `${key}: ${value}`);\n let logMessage = '';\n if (name) {\n logMessage += `${name} `;\n }\n logMessage += `${id}: ${message}`;\n void kv;\n console.log(logMessage, kv.join(', '));\n }\n }\n\n /**\n * Flushes the log buffer (if any buffering mechanism exists).\n */\n async flush(): Promise<void> {\n // No flushing needed for console transport\n }\n\n /**\n * Closes the transport (not needed for console, but keeping the method for consistency).\n */\n async close(): Promise<void> {\n // No close logic needed for console transport\n }\n\n /**\n * Returns the status of the transport (always \"connected\" for console).\n */\n status(): string {\n return 'connected';\n }\n}\n"],
5
+ "mappings": ";AAiBO,IAAM,sBAAN,MAAqD;AAAA,EAChD;AAAA,EAER,YAAY,EAAE,SAAS,OAAO,GAA8B;AACxD,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,QAA0D;AAChE,SAAK,SAAS,OAAO,UAAU;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,KAAgC;AACvC,QAAI,KAAK,WAAW,QAAQ;AACxB,cAAQ,IAAI,KAAK,UAAU,GAAG,CAAC;AAAA,IACnC,WAAW,KAAK,WAAW,WAAW;AAClC,YAAM,EAAE,SAAS,GAAG,KAAK,IAAI;AAC7B,YAAM,iBAAiB;AAAA,QACnB,SAAS;AAAA,QACT,QAAQ,IAAI;AAAA,QACZ,QAAQ;AAAA,UACJ;AAAA,UACA,GAAG;AAAA,QACP;AAAA,QACA,IAAI,IAAI,MAAM,KAAK,IAAI;AAAA,MAC3B;AACA,cAAQ,IAAI,KAAK,UAAU,cAAc,CAAC;AAAA,IAC9C,OAAO;AACH,YAAM,EAAE,MAAM,IAAI,SAAS,OAAO,GAAG,qBAAqB,IAAI;AAC9D,YAAM,KAAK,OAAO,QAAQ,oBAAoB,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,GAAG,GAAG,KAAK,KAAK,EAAE;AACxF,UAAI,aAAa;AACjB,UAAI,MAAM;AACN,sBAAc,GAAG,IAAI;AAAA,MACzB;AACA,oBAAc,GAAG,EAAE,KAAK,OAAO;AAC/B,WAAK;AACL,cAAQ,IAAI,YAAY,GAAG,KAAK,IAAI,CAAC;AAAA,IACzC;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAAA,EAE7B;AAAA;AAAA;AAAA;AAAA,EAKA,SAAiB;AACb,WAAO;AAAA,EACX;AACJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fixparser-plugin-log-console",
3
- "version": "9.1.7-af630b11",
4
- "description": "Console / JSON Log transport for FIXParser",
3
+ "version": "9.1.7-b8fd1147",
4
+ "description": "Console / JSON Log Transport for FIXParser",
5
5
  "files": [
6
6
  "./build/",
7
7
  "./types/",
@@ -24,14 +24,14 @@
24
24
  },
25
25
  "author": "Victor Norgren",
26
26
  "dependencies": {
27
- "fixparser-common": "*"
27
+ "fixparser-common": "next"
28
28
  },
29
29
  "keywords": [
30
30
  "FIXParser",
31
31
  "FIXParser Logger",
32
+ "Console Log Transport",
32
33
  "Console Logger",
33
- "Console JSON Logger",
34
- "Console Log Transport"
34
+ "Console JSON Logger"
35
35
  ],
36
36
  "homepage": "https://fixparser.dev",
37
37
  "license": "LICENSE.md",
@@ -4,13 +4,14 @@ import type { ILogTransporter, LogMessage } from 'fixparser-common';
4
4
  *
5
5
  * - 'console': Output log in plain text format
6
6
  * - 'json': Output log in JSON format
7
+ * - 'jsonrpc': Output log in JSON-RPC 2.0 format
7
8
  *
8
9
  * @public
9
10
  */
10
- export type ConsoleFormat = 'console' | 'json';
11
+ export type ConsoleFormat = 'console' | 'json' | 'jsonrpc';
11
12
  /**
12
13
  * A LogTransporter implementation for logging to the console.
13
- * It supports both text (console) and JSON formats.
14
+ * It supports text (console), JSON, and JSON-RPC 2.0 formats.
14
15
  */
15
16
  export declare class ConsoleLogTransport implements ILogTransporter {
16
17
  private format;
@@ -20,10 +21,10 @@ export declare class ConsoleLogTransport implements ILogTransporter {
20
21
  format: ConsoleFormat;
21
22
  });
22
23
  /**
23
- * Configures the format for console logging (either 'console' for text or 'json').
24
+ * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc').
24
25
  */
25
26
  configure(config: {
26
- format: 'console' | 'json';
27
+ format: 'console' | 'json' | 'jsonrpc';
27
28
  }): void;
28
29
  /**
29
30
  * Sends the log message to the console in the configured format.