Skip to content

Commit 8461e9e

Browse files
authored
Merge pull request #852 from LIT-Protocol/feature/escal-51-tgosmosis-lit-sdk-log-output
feat(logge): add json log formatter
2 parents 222efe0 + 92a696f commit 8461e9e

File tree

35 files changed

+314
-49
lines changed

35 files changed

+314
-49
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"useNx": true,
44
"useWorkspaces": true,
5-
"version": "7.2.1"
5+
"version": "7.2.4-alpha.0"
66
}

local-tests/setup/tinny-config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ export interface ProcessEnvs {
2828
*/
2929
DEBUG: boolean;
3030

31+
/**
32+
* The log format to use for structured logging. Can be 'text', 'json', or 'datadog'.
33+
* Defaults to 'json' for test environments.
34+
*/
35+
LOG_FORMAT: 'text' | 'json' | 'datadog';
36+
37+
/**
38+
* The service name to use in structured logs. Helps identify test logs in monitoring systems.
39+
* Defaults to 'tinny-tests'.
40+
*/
41+
SERVICE_NAME: string;
42+
3143
/**
3244
* Capacity Credits: In order to execute a transaction with Lit, you’ll need to reserve capacity on the network using Capacity Credits. These allow holders to reserve a set number of requests over a desired period of time (by default expiration set to 2 days)
3345
*/

local-tests/setup/tinny-environment.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export class TinnyEnvironment {
3434
NETWORK:
3535
(process.env['NETWORK'] as LIT_NETWORK_VALUES) || LIT_NETWORK.Custom,
3636
DEBUG: process.env['DEBUG'] === 'true',
37+
LOG_FORMAT:
38+
(process.env['LOG_FORMAT'] as 'text' | 'json' | 'datadog') || 'json',
39+
SERVICE_NAME: process.env['SERVICE_NAME'] || 'tinny-tests',
3740
REQUEST_PER_KILOSECOND:
3841
parseInt(process.env['REQUEST_PER_KILOSECOND']) ||
3942
(process.env['NETWORK'] as LIT_NETWORK_VALUES) === 'datil-dev'
@@ -247,18 +250,24 @@ export class TinnyEnvironment {
247250
debug: this.processEnvs.DEBUG,
248251
checkNodeAttestation: false, // disable node attestation check for local testing
249252
contractContext: networkContext,
253+
logFormat: this.processEnvs.LOG_FORMAT,
254+
serviceName: this.processEnvs.SERVICE_NAME,
250255
});
251256
} else if (centralisation === 'decentralised') {
252257
this.litNodeClient = new LitNodeClient({
253258
litNetwork: this.network,
254259
checkNodeAttestation: true,
255260
debug: this.processEnvs.DEBUG,
261+
logFormat: this.processEnvs.LOG_FORMAT,
262+
serviceName: this.processEnvs.SERVICE_NAME,
256263
});
257264
} else if (centralisation === 'centralised') {
258265
this.litNodeClient = new LitNodeClient({
259266
litNetwork: this.network,
260267
checkNodeAttestation: false,
261268
debug: this.processEnvs.DEBUG,
269+
logFormat: this.processEnvs.LOG_FORMAT,
270+
serviceName: this.processEnvs.SERVICE_NAME,
262271
});
263272
} else {
264273
throw new Error(`Network not supported: "${this.network}"`);

packages/access-control-conditions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"tags": [
2222
"universal"
2323
],
24-
"version": "7.2.1",
24+
"version": "7.2.4-alpha.0",
2525
"main": "./dist/src/index.js",
2626
"typings": "./dist/src/index.d.ts"
2727
}

packages/auth-browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"tags": [
3232
"browser"
3333
],
34-
"version": "7.2.1",
34+
"version": "7.2.4-alpha.0",
3535
"main": "./dist/src/index.js",
3636
"typings": "./dist/src/index.d.ts"
3737
}

packages/auth-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"crypto": false,
2626
"stream": false
2727
},
28-
"version": "7.2.1",
28+
"version": "7.2.4-alpha.0",
2929
"main": "./dist/src/index.js",
3030
"typings": "./dist/src/index.d.ts"
3131
}

packages/constants/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"tags": [
2121
"universal"
2222
],
23-
"version": "7.2.1",
23+
"version": "7.2.4-alpha.0",
2424
"main": "./dist/src/index.js",
2525
"typings": "./dist/src/index.d.ts"
2626
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const version = '7.2.1';
1+
export const version = '7.2.4-alpha.0';

packages/contracts-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"tags": [
2626
"universal"
2727
],
28-
"version": "7.2.1",
28+
"version": "7.2.4-alpha.0",
2929
"main": "./dist/src/index.js",
3030
"typings": "./dist/src/index.d.ts"
3131
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lit-protocol/core",
3-
"version": "7.2.1",
3+
"version": "7.2.4-alpha.0",
44
"type": "commonjs",
55
"license": "MIT",
66
"homepage": "https://github.com/Lit-Protocol/js-sdk",

0 commit comments

Comments
 (0)