Skip to content

Commit

Permalink
feat: add status and trace id in logs (#1100)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark authored Mar 2, 2024
1 parent 6bffe87 commit a2f3d7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-roses-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@unkey/api": patch
---

Include status and trace id in logs
5 changes: 3 additions & 2 deletions packages/api/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,14 @@ export class Unkey {
}
const backoff = this.retry.backoff(i);
console.debug(
"attempt %d of %d to reach %s failed, retrying in %d ms: %s",
"attempt %d of %d to reach %s failed, retrying in %d ms: %s | %s",
i + 1,
this.retry.attempts + 1,
url,
backoff,
// @ts-ignore I don't understand why `err` is `never`
err?.message,
err?.message ?? `status=${res?.status}`,
res?.headers.get("unkey-request-id"),
);
await new Promise((r) => setTimeout(r, backoff));
}
Expand Down

0 comments on commit a2f3d7a

Please sign in to comment.