Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging from worker context. #11

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Release Notes

#### v1.0.4

- Fix logging from worker threads.

#### v1.0.3

- Added Release notes.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devrev/ts-adaas",
"version": "1.0.3",
"version": "1.0.4",
"description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/deprecated/adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ export class Adapter<ConnectorState> {
adapterState: State<ConnectorState>,
isLocalDevelopment: boolean = false
) {
// if (!isLocalDevelopment) {
// Logger.init(event);
// }
if (!isLocalDevelopment) {
// Logger.init(event);
}

this.adapterState = adapterState;
this._artifacts = [];
Expand Down
4 changes: 3 additions & 1 deletion src/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Logger extends Console {
parentPort?.postMessage({
subject: WorkerMessageSubject.WorkerMessageLog,
payload: {
args,
args: JSON.parse(JSON.stringify(args)),
level,
},
});
Expand All @@ -65,7 +65,9 @@ export class Logger extends Console {
}

// Helper function to process each value in the state
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getPrintableState(state: Record<string, any>): PrintableState {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function processValue(value: any): any {
if (Array.isArray(value)) {
// If the value is an array, summarize it
Expand Down
Loading