Compare View
Commits (3)
Changes
Showing 4 changed files Side-by-side Diff
CHANGELOG.md
... | ... | @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d |
4 | 4 | |
5 | 5 | Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). |
6 | 6 | |
7 | +#### [v1.43.10](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.43.9...v1.43.10) | |
8 | + | |
9 | +- Add xid and stringify report message if is not a string [`fa8323a`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/fa8323a1a85d9501436a2dffd3a9fb2ff1858084) | |
10 | +- Bump to tektrans-logger@1.2.3 [`c0b96d3`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/c0b96d30e5dd701123f5f7d33533eb1020008c97) | |
11 | + | |
7 | 12 | #### [v1.43.9](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.43.8...v1.43.9) |
8 | 13 | |
14 | +> 24 November 2021 | |
15 | + | |
9 | 16 | - Migrate to tektrans-logger on api-server [`020fbb8`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/020fbb814e3ae515b67993d3f794669e5782a803) |
10 | 17 | |
11 | 18 | #### [v1.43.8](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.43.7...v1.43.8) |
gateway/pull.js
1 | 1 | const IS_DEBUG = process.env.KOMODO_SDK_DEBUG_PULL; |
2 | 2 | |
3 | 3 | const request = require('request'); |
4 | +const stringify = require('json-stringify-pretty-compact'); | |
4 | 5 | const logger = require('tektrans-logger'); |
5 | 6 | |
6 | 7 | const config = require('../config'); |
... | ... | @@ -288,7 +289,7 @@ function replaceRc(original_rc) { |
288 | 289 | return config.replace_rc[original_rc] || original_rc; |
289 | 290 | } |
290 | 291 | |
291 | -function report(data) { | |
292 | +function report(data, xid) { | |
292 | 293 | |
293 | 294 | let core_pull_report_url; |
294 | 295 | |
... | ... | @@ -328,7 +329,7 @@ function report(data) { |
328 | 329 | trx_id: trx_id, |
329 | 330 | rc: replaceRc(data.rc), |
330 | 331 | rc_from_handler: data.rc_from_handler, |
331 | - message: data.message, | |
332 | + message: typeof data.message === 'string' ? data.message : stringify(data.message), | |
332 | 333 | handler: config.handler_name, |
333 | 334 | sn: data.sn, |
334 | 335 | amount: data.amount, |
... | ... | @@ -342,20 +343,22 @@ function report(data) { |
342 | 343 | } |
343 | 344 | |
344 | 345 | if (!config.do_not_verbose_log_report) { |
345 | - logger.verbose('Report to CORE using HTTP POST'); | |
346 | + logger.verbose('Report to CORE using HTTP POST', { xid }); | |
346 | 347 | } |
347 | 348 | |
348 | 349 | request.post(options, function(error, response) { |
349 | 350 | if (error) { |
350 | - logger.warn('Error reporting to CORE', {error: error}); | |
351 | + logger.warn('Error reporting to CORE', { xid, error }); | |
351 | 352 | resendReport(data); |
352 | 353 | } |
353 | 354 | else if (response.statusCode != 200) { |
354 | - logger.warn('Error reporting to CORE, http response status is not 200', {requestOptions: options, http_response_status: response.statusCode}); | |
355 | + logger.warn('Error reporting to CORE, http response status is not 200', { | |
356 | + xid, requestOptions: options, http_response_status: response.statusCode, | |
357 | + }); | |
355 | 358 | resendReport(data); |
356 | 359 | } |
357 | 360 | else if (!config.do_not_verbose_log_report) { |
358 | - logger.verbose('Report has been sent to CORE', {requestOptions: options}); | |
361 | + logger.verbose('Report has been sent to CORE', { xid, requestOptions: options }); | |
359 | 362 | } |
360 | 363 | }); |
361 | 364 | } |
package-lock.json
1 | 1 | { |
2 | 2 | "name": "komodo-sdk", |
3 | - "version": "1.43.9", | |
3 | + "version": "1.43.10", | |
4 | 4 | "lockfileVersion": 2, |
5 | 5 | "requires": true, |
6 | 6 | "packages": { |
7 | 7 | "": { |
8 | 8 | "name": "komodo-sdk", |
9 | - "version": "1.43.9", | |
9 | + "version": "1.43.10", | |
10 | 10 | "license": "ISC", |
11 | 11 | "dependencies": { |
12 | 12 | "array-unique": "^0.3.2", |
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | "express-session": "^1.15.6", |
19 | 19 | "fs-copy-file": "^2.1.2", |
20 | 20 | "json-query": "^2.2.2", |
21 | + "json-stringify-pretty-compact": "^3.0.0", | |
21 | 22 | "lru-cache": "^4.1.1", |
22 | 23 | "macaddress": "^0.2.9", |
23 | 24 | "moment": "^2.24.0", |
... | ... | @@ -33,7 +34,7 @@ |
33 | 34 | "stack-trace": "0.0.10", |
34 | 35 | "strftime": "^0.10.0", |
35 | 36 | "string-natural-compare": "^2.0.2", |
36 | - "tektrans-logger": "^1.2.2", | |
37 | + "tektrans-logger": "^1.2.3", | |
37 | 38 | "uniqid": "^4.1.1", |
38 | 39 | "uuid": "^3.4.0" |
39 | 40 | }, |
... | ... | @@ -1656,6 +1657,11 @@ |
1656 | 1657 | "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", |
1657 | 1658 | "dev": true |
1658 | 1659 | }, |
1660 | + "node_modules/json-stringify-pretty-compact": { | |
1661 | + "version": "3.0.0", | |
1662 | + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-3.0.0.tgz", | |
1663 | + "integrity": "sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==" | |
1664 | + }, | |
1659 | 1665 | "node_modules/json-stringify-safe": { |
1660 | 1666 | "version": "5.0.1", |
1661 | 1667 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", |
... | ... | @@ -2539,9 +2545,9 @@ |
2539 | 2545 | } |
2540 | 2546 | }, |
2541 | 2547 | "node_modules/tektrans-logger": { |
2542 | - "version": "1.2.2", | |
2543 | - "resolved": "https://registry.npmjs.org/tektrans-logger/-/tektrans-logger-1.2.2.tgz", | |
2544 | - "integrity": "sha512-GVBcpZrq6vUrjXdoSpF/Hqn3UTKODMkCZ/1RPXwt8sGuLSyYQXgpVlrXJ0Sezhu+N6jiBtkjDAClAenwyrXVuQ==", | |
2548 | + "version": "1.2.3", | |
2549 | + "resolved": "https://registry.npmjs.org/tektrans-logger/-/tektrans-logger-1.2.3.tgz", | |
2550 | + "integrity": "sha512-bfdgBH374s+p5sv0EZeYEktPBrY4ulMOxlgc8lhN14xYjSnhLxnWzTs26IuBYbwEwlSdp0U/8G7fVsIAtNL7BA==", | |
2545 | 2551 | "dependencies": { |
2546 | 2552 | "mkdirp": "^1.0.4", |
2547 | 2553 | "redis": "^2.8.0", |
... | ... | @@ -4212,6 +4218,11 @@ |
4212 | 4218 | "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", |
4213 | 4219 | "dev": true |
4214 | 4220 | }, |
4221 | + "json-stringify-pretty-compact": { | |
4222 | + "version": "3.0.0", | |
4223 | + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-3.0.0.tgz", | |
4224 | + "integrity": "sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==" | |
4225 | + }, | |
4215 | 4226 | "json-stringify-safe": { |
4216 | 4227 | "version": "5.0.1", |
4217 | 4228 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", |
... | ... | @@ -4879,9 +4890,9 @@ |
4879 | 4890 | } |
4880 | 4891 | }, |
4881 | 4892 | "tektrans-logger": { |
4882 | - "version": "1.2.2", | |
4883 | - "resolved": "https://registry.npmjs.org/tektrans-logger/-/tektrans-logger-1.2.2.tgz", | |
4884 | - "integrity": "sha512-GVBcpZrq6vUrjXdoSpF/Hqn3UTKODMkCZ/1RPXwt8sGuLSyYQXgpVlrXJ0Sezhu+N6jiBtkjDAClAenwyrXVuQ==", | |
4893 | + "version": "1.2.3", | |
4894 | + "resolved": "https://registry.npmjs.org/tektrans-logger/-/tektrans-logger-1.2.3.tgz", | |
4895 | + "integrity": "sha512-bfdgBH374s+p5sv0EZeYEktPBrY4ulMOxlgc8lhN14xYjSnhLxnWzTs26IuBYbwEwlSdp0U/8G7fVsIAtNL7BA==", | |
4885 | 4896 | "requires": { |
4886 | 4897 | "mkdirp": "^1.0.4", |
4887 | 4898 | "redis": "^2.8.0", |
package.json
1 | 1 | { |
2 | 2 | "name": "komodo-sdk", |
3 | - "version": "1.43.9", | |
3 | + "version": "1.43.10", | |
4 | 4 | "description": "SDK for Komodo", |
5 | 5 | "main": "index.js", |
6 | 6 | "scripts": { |
... | ... | @@ -29,6 +29,7 @@ |
29 | 29 | "express-session": "^1.15.6", |
30 | 30 | "fs-copy-file": "^2.1.2", |
31 | 31 | "json-query": "^2.2.2", |
32 | + "json-stringify-pretty-compact": "^3.0.0", | |
32 | 33 | "lru-cache": "^4.1.1", |
33 | 34 | "macaddress": "^0.2.9", |
34 | 35 | "moment": "^2.24.0", |
... | ... | @@ -44,7 +45,7 @@ |
44 | 45 | "stack-trace": "0.0.10", |
45 | 46 | "strftime": "^0.10.0", |
46 | 47 | "string-natural-compare": "^2.0.2", |
47 | - "tektrans-logger": "^1.2.2", | |
48 | + "tektrans-logger": "^1.2.3", | |
48 | 49 | "uniqid": "^4.1.1", |
49 | 50 | "uuid": "^3.4.0" |
50 | 51 | }, |