Skip to content

Commit

Permalink
fix: Pass logLevel down to the native consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyJones committed Oct 2, 2021
1 parent 362a291 commit 88b329c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/consumer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
INTERACTION_PART_REQUEST,
INTERACTION_PART_RESPONSE,
} from '../ffi/types';
import { logCrashAndThrow, logErrorAndThrow } from '../logger';
import { getLogLevel, logCrashAndThrow, logErrorAndThrow } from '../logger';
import { wrapAllWithCheck, wrapWithCheck } from './checkErrors';

import {
Expand All @@ -25,9 +25,10 @@ type JsonArray = Array<AnyJson>;
export const makeConsumerPact = (
consumer: string,
provider: string,
version: FfiSpecificationVersion
version: FfiSpecificationVersion,
logLevel = getLogLevel()
): ConsumerPact => {
const lib = getFfiLib();
const lib = getFfiLib(logLevel);

const pactPtr = lib.pactffi_new_pact(consumer, provider);
if (!lib.pactffi_with_specification(pactPtr, version)) {
Expand Down
2 changes: 2 additions & 0 deletions src/logger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const setLogLevel = (level: LogLevel = 'info'): void => {
logger = createLogger(currentLogLevel);
};

export const getLogLevel = (): LogLevel => currentLogLevel;

export const verboseIsImplied = (): boolean =>
currentLogLevel === 'trace' || currentLogLevel === 'debug';

Expand Down

0 comments on commit 88b329c

Please sign in to comment.