You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main export is the log helper function with other helpers decorated as properties on this function. Some apps, like assemble, verb and generate support this format. However, a non-enumberalbe toObject method is exposed for registering directly with engines like handlebars
Example:
varloggingHelpers=require('logging-helpers');varhbs=require('handlebars');hbs.registerHelper('log',helpers);// register all of the other helpershbs.registerHelper(helpers.toObject);
Template examples
Handlebars:
{{log"%s""this is a message"}}{{info"%s""this is a message"}}{{warning"%s""this is a message"}}{{warn"%s""this is a message"}}<!-- alias for "warning" -->{{success"%s""this is a message"}}{{error"%s""this is a message"}}{{danger"%s""this is a message"}}<!-- alias for "error" -->{{ok"%s""this is a message"}}{{bold"%s""this is a message"}}{{_debugthis}}{{_inspectfoo.bar}}
Lo-Dash or Underscore:
<%= log("%s", "this is a message") %><%= info("%s", "this is a message") %><%= warn("%s", "this is a message") %><%= warning("%s", "this is a message") %><%= error("%s", "this is a message") %><%= bold("%s", "this is a message") %><%= _debug(data) %><%= _inspect(foo.bar) %>
Verb (uses lodash-style templates, but 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)%}
{{log"%s""this is a message"}}{{info"%s""this is a message"}}{{warning"%s""this is a message"}}{{warn"%s""this is a message"}}<!-- alias for "warning" -->{{success"%s""this is a message"}}{{error"%s""this is a message"}}{{danger"%s""this is a message"}}<!-- alias for "error" -->{{ok"%s""this is a message"}}{{bold"%s""this is a message"}}{{_debugthis}}{{_inspectfoo.bar}}
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: