logging-helpers
Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.
Install
Install with npm
npm i logging-helpers --save
Run tests
npm test
Register the helper
This should work with any engine, here are a few examples
template.helpers('logging-helpers', require('logging-helpers'));
assemble.helpers('logging-helpers', require('logging-helpers'));
verb.helpers('logging-helpers', require('logging-helpers'));
var handlebars = require('handlebars');
handlebars.registerHelper('logging-helpers', require('logging-helpers'));
Example usage
Handlebars:
{{log "%s" "this is a message"}}
{{info "%s" "this is a message"}}
{{bold "%s" "this is a message"}}
{{warn "%s" "this is a message"}}
{{error "%s" "this is a message"}}
Lo-Dash or Underscore:
<%%= log("%s", "this is a message") %>
<%%= info("%s", "this is a message") %>
<%%= bold("%s", "this is a message") %>
<%%= warn("%s", "this is a message") %>
<%%= error("%s", "this is a message") %>
Verb (lo-dash, with special delimiters to avoid delimiter collision in documentation):
{%= log("%s", "this is a message") %}
{%= info("%s", "this is a message") %}
{%= bold("%s", "this is a message") %}
{%= warn("%s", "this is a message") %}
{%= error("%s", "this is a message") %}
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on November 11, 2014.