Skip to content

Commit

Permalink
fix(verifier): Correctly pass down log levels to the native core
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyJones committed Oct 2, 2021
1 parent 6087b86 commit c11ce75
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ffi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let ffiLogLevel: LogLevel;

const initialiseFfi = (logLevel: LogLevel): FfiBinding<FfiDeclarations> => {
logger.debug(`Initalising native core at log level '${logLevel}'`);
process.env[LOG_ENV_VAR_NAME] = logLevel;
process.env[LOG_ENV_VAR_NAME] = logLevel.toUpperCase();
ffiLogLevel = logLevel;
const lib = createFfi(
libName('pact_ffi', `v${PACT_FFI_VERSION}`),
Expand Down
2 changes: 1 addition & 1 deletion src/verifier/arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const argMapping: ArgMapping<
? ['--port', u.port, '--hostname', u.hostname]
: [];
},
logLevel: (logLevel: LogLevel) => ['--loglevel', logLevel],
logLevel: (logLevel: LogLevel) => ['--loglevel', logLevel.toUpperCase()],
provider: { arg: '--provider-name', mapper: 'string' },
pactUrls: (pactUrls: string[]) =>
pactUrls.reduce<Array<string>>((acc: Array<string>, uri: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/verifier/nativeVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const VERIFICATION_FAILED = 1;
const INVALID_ARGUMENTS = 4;

export const verify = (opts: VerifierOptions): Promise<string> => {
const verifierLib = getFfiLib();
const verifierLib = getFfiLib(opts.logLevel);
// Todo: probably separate out the sections of this logic into separate promises
return new Promise<string>((resolve, reject) => {
const request = argumentMapper(argMapping, opts, ignoredArguments)
Expand Down

0 comments on commit c11ce75

Please sign in to comment.