-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds multiple variable support and the ability to set statement level logging semantics. This breaks that logger API, cleaning up the manner in which enums are set, but the other behaviors are backwards compatible. Fixes #956
- Loading branch information
Showing
3 changed files
with
100 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
export default function(instance) { | ||
instance.registerHelper('log', function(message, options) { | ||
let level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; | ||
instance.log(level, message); | ||
instance.registerHelper('log', function(/* message, options */) { | ||
let args = [undefined], | ||
options = arguments[arguments.length - 1]; | ||
for (let i = 0; i < arguments.length - 1; i++) { | ||
args.push(arguments[i]); | ||
} | ||
|
||
let level = 1; | ||
if (options.hash.level != null) { | ||
level = options.hash.level; | ||
} else if (options.data && options.data.level != null) { | ||
level = options.data.level; | ||
} | ||
args[0] = level; | ||
|
||
instance.log(... args); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters