Skip to content

Commit

Permalink
feat: log match subroutine input
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Dec 4, 2018
1 parent 89b219d commit eab4542
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/subroutines/matchSubroutine.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import {
import {
InvalidValueSentinel
} from '../sentinels';
import Logger from '../Logger';

const log = Logger.child({
namespace: 'subroutine:match'
});

const matchSubroutine = (subject: string, [userRule, sprintfFormat]: $ReadOnlyArray<string>) => {
const rule: RegExp = parseRegex(userRule);
Expand All @@ -21,6 +26,10 @@ const matchSubroutine = (subject: string, [userRule, sprintfFormat]: $ReadOnlyAr
const matches = subject.match(rule);

if (!matches) {
log.debug({
input: subject
}, 'input');

return new InvalidValueSentinel('Input does not match "' + rule.toString() + '" regular expression.');
}

Expand Down

0 comments on commit eab4542

Please sign in to comment.