Skip to content

Commit 61fefc0

Browse files
meorphismeorphis
andauthored
chore: thread log level through to clients (#203)
* chore: thread log level through to clients * lint --------- Co-authored-by: meorphis <eric@stainless.com>
1 parent 0e2a297 commit 61fefc0

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

dist/build.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/merge.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/preview.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compat/github/api.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { logger } from "../../logger";
1010
import type { APIClient, Comment, PullRequest } from "../api";
1111
import { getInput } from "../input";
1212
import { getGitHubContext as ctx } from "./context";
13+
import { LogLevel } from "@stainless-api/github-internal/client";
1314

1415
class GitHubClient implements APIClient {
1516
private client: PartialGitHub<{
@@ -27,6 +28,9 @@ class GitHubClient implements APIClient {
2728
owner: ctx().owner,
2829
repo: ctx().repo,
2930
resources: [BaseCommits, BaseComments, BasePulls],
31+
logLevel: (getInput("log_level", { required: false }) ??
32+
"warn") as LogLevel,
33+
logger,
3034
});
3135
}
3236

src/compat/gitlab/api.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { logger } from "../../logger";
1515
import type { APIClient, Comment, PullRequest } from "../api";
1616
import { getInput } from "../input";
1717
import { getGitLabContext as ctx } from "./context";
18+
import { LogLevel } from "@stainless-api/gitlab-internal/client";
1819

1920
class GitLabClient implements APIClient {
2021
private client: PartialGitLab<{
@@ -29,6 +30,9 @@ class GitLabClient implements APIClient {
2930
apiToken: token,
3031
baseURL: ctx().urls.api,
3132
resources: [BaseCommits, BaseMergeRequests, BaseNotes],
33+
logLevel: (getInput("log_level", { required: false }) ??
34+
"warn") as LogLevel,
35+
logger,
3236
});
3337
}
3438

src/wrapAction.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getInput } from "./compat/input";
33
import { getStainlessAuth } from "./compat";
44
import { createAutoRefreshFetch, getStainlessClient } from "./stainless";
55
import { logger } from "./logger";
6+
import { LogLevel } from "@stainless-api/sdk/client";
67

78
const accumulatedBuildIds = new Set<string>();
89

@@ -31,7 +32,9 @@ export function wrapAction(
3132
stainless = getStainlessClient(actionType, {
3233
project: projectName,
3334
apiKey: auth.key,
34-
logLevel: "warn",
35+
logLevel: (getInput("log_level", { required: false }) ??
36+
"warn") as LogLevel,
37+
logger,
3538
fetch: createAutoRefreshFetch(auth, getStainlessAuth),
3639
});
3740
await fn(stainless);

0 commit comments

Comments
 (0)