Skip to content

Commit

Permalink
Ensure functionsEmulator respects logVerbosity (#6521)
Browse files Browse the repository at this point in the history
  • Loading branch information
joehan authored Nov 14, 2023
1 parent ea58114 commit aeb2901
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Fix blocking functions in the emulator when using multiple codebases (#6504).
- Add force flag call-out for bypassing prompts (#6506).
- Fixed an issue where the functions emulator did not respect the `--log-verbosity` flag (#2859).
2 changes: 1 addition & 1 deletion scripts/emulator-tests/functionsEmulator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe("FunctionsEmulator", function () {
projectId: TEST_PROJECT_ID,
projectDir: MODULE_ROOT,
emulatableBackends: [TEST_BACKEND],
quiet: true,
verbosity: "QUIET",
adminSdkConfig: {
projectId: TEST_PROJECT_ID,
databaseURL: `https://${TEST_PROJECT_ID}-default-rtdb.firebaseio.com`,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ export async function startAll(
host: functionsAddr.host,
port: functionsAddr.port,
debugPort: inspectFunctions,
verbosity: options.logVerbosity,
projectAlias: options.projectAlias,
});
await startEmulator(functionsEmulator);
Expand Down
6 changes: 4 additions & 2 deletions src/emulator/functionsEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export interface FunctionsEmulatorArgs {
account?: Account;
port?: number;
host?: string;
quiet?: boolean;
verbosity?: "SILENT" | "QUIET" | "INFO" | "DEBUG";
disabledRuntimeFeatures?: FunctionsRuntimeFeatures;
debugPort?: number;
remoteEmulators?: Record<string, EmulatorInfo>;
Expand Down Expand Up @@ -215,7 +215,9 @@ export class FunctionsEmulator implements EmulatorInstance {

constructor(private args: FunctionsEmulatorArgs) {
// TODO: Would prefer not to have static state but here we are!
EmulatorLogger.setVerbosity(this.args.quiet ? Verbosity.QUIET : Verbosity.DEBUG);
EmulatorLogger.setVerbosity(
this.args.verbosity ? Verbosity[this.args.verbosity] : Verbosity["DEBUG"]
);
// When debugging is enabled, the "timeout" feature needs to be disabled so that
// functions don't timeout while a breakpoint is active.
if (this.args.debugPort) {
Expand Down
2 changes: 1 addition & 1 deletion src/functionsShellCommandAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const actionFunction = async (options: Options) => {

return serveFunctions
.start(options, {
quiet: true,
verbosity: "QUIET",
remoteEmulators,
debugPort,
})
Expand Down

0 comments on commit aeb2901

Please sign in to comment.