JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 112430
  • Score
    100M100P100Q154995F
  • License

Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.

Package Exports

  • logging-helpers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (logging-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

logging-helpers NPM version

Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.

Install with npm

npm i logging-helpers --save

Usage examples

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"}}
{{debug this}}
{{inspect foo.bar}}

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") %>
<%%= debug(data) %>
<%%= inspect(foo.bar) %>

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") %}
{%= debug(data) %}
{%= inspect(foo.bar) %}

Register the helper

This should work with any engine, here are a few examples

template

template.helpers('logging-helpers', require('logging-helpers'));

assemble

assemble.helpers('logging-helpers', require('logging-helpers'));

verb

verb.helpers('logging-helpers', require('logging-helpers'));

handlebars

var handlebars = require('handlebars');
handlebars.registerHelper('logging-helpers', require('logging-helpers'));

Run tests

Install dev dependencies.

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on January 20, 2015.