From eab4542f9e63b1be3fc4b1f7346ef440a26d4761 Mon Sep 17 00:00:00 2001 From: Gajus Kuizinas Date: Tue, 4 Dec 2018 19:07:09 +0200 Subject: [PATCH] feat: log match subroutine input --- src/subroutines/matchSubroutine.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/subroutines/matchSubroutine.js b/src/subroutines/matchSubroutine.js index 96ad87b..031747f 100644 --- a/src/subroutines/matchSubroutine.js +++ b/src/subroutines/matchSubroutine.js @@ -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) => { const rule: RegExp = parseRegex(userRule); @@ -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.'); }