@sentio/runtime 2.57.5 → 2.57.6-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.57.5",
3
+ "version": "2.57.6-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
package/src/logger.ts CHANGED
@@ -1,20 +1,16 @@
1
1
  import { createLogger, format, transports } from 'winston'
2
2
 
3
- function stringify(obj: any) {
4
- let cache: any[] = []
5
- const str = JSON.stringify(obj, function (key, value) {
3
+ function stringify(obj: any): string {
4
+ const cache = new WeakSet()
5
+ return JSON.stringify(obj, function (key, value) {
6
6
  if (typeof value === 'object' && value !== null) {
7
- if (cache.indexOf(value) !== -1) {
8
- // Circular reference found, discard key
9
- return
7
+ if (cache.has(value)) {
8
+ return '[Circular]'
10
9
  }
11
- // Store value in our collection
12
- cache.push(value)
10
+ cache.add(value)
13
11
  }
14
12
  return value
15
13
  })
16
- cache = []
17
- return str
18
14
  }
19
15
 
20
16
  export function setupLogger(json: boolean, enableDebug: boolean) {
@@ -41,6 +41,7 @@ const optionDefinitions = [
41
41
  { name: 'pricefeed-server', type: String, defaultValue: '' },
42
42
  { name: 'log-format', type: String, defaultValue: 'console' },
43
43
  { name: 'debug', type: Boolean, defaultValue: false },
44
+ { name: 'otlp-debug', type: Boolean, defaultValue: false },
44
45
  { name: 'start-action-server', type: Boolean, defaultValue: false }
45
46
  ]
46
47
 
@@ -51,7 +52,7 @@ const logLevel = process.env['LOG_LEVEL']?.toUpperCase()
51
52
  setupLogger(options['log-format'] === 'json', logLevel === 'debug' ? true : options.debug)
52
53
  console.debug('Starting with', options.target)
53
54
 
54
- await setupOTLP(options.debug)
55
+ await setupOTLP(options['otlp-debug'])
55
56
 
56
57
  Error.stackTraceLimit = 20
57
58