Skip to content

Commit 88b329c

Browse files
committed
fix: Pass logLevel down to the native consumer
1 parent 362a291 commit 88b329c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/consumer/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
INTERACTION_PART_REQUEST,
77
INTERACTION_PART_RESPONSE,
88
} from '../ffi/types';
9-
import { logCrashAndThrow, logErrorAndThrow } from '../logger';
9+
import { getLogLevel, logCrashAndThrow, logErrorAndThrow } from '../logger';
1010
import { wrapAllWithCheck, wrapWithCheck } from './checkErrors';
1111

1212
import {
@@ -25,9 +25,10 @@ type JsonArray = Array<AnyJson>;
2525
export const makeConsumerPact = (
2626
consumer: string,
2727
provider: string,
28-
version: FfiSpecificationVersion
28+
version: FfiSpecificationVersion,
29+
logLevel = getLogLevel()
2930
): ConsumerPact => {
30-
const lib = getFfiLib();
31+
const lib = getFfiLib(logLevel);
3132

3233
const pactPtr = lib.pactffi_new_pact(consumer, provider);
3334
if (!lib.pactffi_with_specification(pactPtr, version)) {

src/logger/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export const setLogLevel = (level: LogLevel = 'info'): void => {
1616
logger = createLogger(currentLogLevel);
1717
};
1818

19+
export const getLogLevel = (): LogLevel => currentLogLevel;
20+
1921
export const verboseIsImplied = (): boolean =>
2022
currentLogLevel === 'trace' || currentLogLevel === 'debug';
2123

0 commit comments

Comments
 (0)