Skip to content

Commit b58e106

Browse files
authored
Fix logging from worker context. (#11)
Fix logging from worker context to provide human-readable and sensible log lines. https://app.devrev.ai/devrev/works/ISS-133761
1 parent ff8a11d commit b58e106

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Release Notes
44

5+
#### v1.0.4
6+
7+
- Fix logging from worker threads.
8+
59
#### v1.0.3
610

711
- Added Release notes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devrev/ts-adaas",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
55
"type": "commonjs",
66
"main": "./dist/index.js",

src/deprecated/adapter/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ export class Adapter<ConnectorState> {
7777
adapterState: State<ConnectorState>,
7878
isLocalDevelopment: boolean = false
7979
) {
80-
// if (!isLocalDevelopment) {
81-
// Logger.init(event);
82-
// }
80+
if (!isLocalDevelopment) {
81+
// Logger.init(event);
82+
}
8383

8484
this.adapterState = adapterState;
8585
this._artifacts = [];

src/logger/logger.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Logger extends Console {
4040
parentPort?.postMessage({
4141
subject: WorkerMessageSubject.WorkerMessageLog,
4242
payload: {
43-
args,
43+
args: JSON.parse(JSON.stringify(args)),
4444
level,
4545
},
4646
});
@@ -65,7 +65,9 @@ export class Logger extends Console {
6565
}
6666

6767
// Helper function to process each value in the state
68+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6869
export function getPrintableState(state: Record<string, any>): PrintableState {
70+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6971
function processValue(value: any): any {
7072
if (Array.isArray(value)) {
7173
// If the value is an array, summarize it

0 commit comments

Comments
 (0)