Skip to content

Commit 5b52002

Browse files
NicolappsConvex, Inc.
authored andcommitted
npx convex run: send log lines to stderr (#41196)
GitOrigin-RevId: 9d1f17101e5bc5e8d9ef19bb9df95876be9fc2f3
1 parent c8d8f22 commit 5b52002

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/cli/lib/run.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import JSON5 from "json5";
1616
import path from "path";
1717
import { readProjectConfig } from "./config.js";
1818
import { watchAndPush } from "./dev.js";
19+
import { Logger, DefaultLogger } from "../../browser/logging.js";
1920

2021
export async function runFunctionAndLog(
2122
ctx: Context,
@@ -33,7 +34,9 @@ export async function runFunctionAndLog(
3334
| undefined;
3435
},
3536
) {
36-
const client = new ConvexHttpClient(args.deploymentUrl);
37+
const client = new ConvexHttpClient(args.deploymentUrl, {
38+
logger: instantiateStderrLogger(),
39+
});
3740
const identity = args.identityString
3841
? await getFakeIdentity(ctx, args.identityString)
3942
: undefined;
@@ -491,3 +494,12 @@ export async function runInDeployment(
491494
}
492495
return await runFunctionAndLog(ctx, args);
493496
}
497+
498+
function instantiateStderrLogger(): Logger {
499+
const logger = new DefaultLogger({ verbose: false });
500+
logger.addLogLineListener((_level, ...args) => {
501+
// eslint-disable-next-line no-console
502+
console.error(...args);
503+
});
504+
return logger;
505+
}

0 commit comments

Comments
 (0)