Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

README.md 1.2 KiB

3 anni fa
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ##eazy-logger [![Build Status](https://travis-ci.org/shakyShane/easy-logger.svg?branch=master)](https://travis-ci.org/shakyShane/easy-logger) [![Coverage Status](https://img.shields.io/coveralls/shakyShane/easy-logger.svg)](https://coveralls.io/r/shakyShane/easy-logger?branch=master)
  2. [tFunk](https://github.com/shakyShane/tfunk) + [String Substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
  3. ![preview](http://cl.ly/image/3K2E2d111l15/Screen%20Shot%202014-09-17%20at%2020.49.17.png)
  4. ##Install
  5. ```
  6. $ npm install eazy-logger --save
  7. ```
  8. ##Usage
  9. ```js
  10. var logger = require("eazy-logger").Logger({
  11. prefix: "{blue:[}{magenta:easy-logger}{blue:] }",
  12. useLevelPrefixes: true
  13. });
  14. ```
  15. ```js
  16. /**
  17. * Standard loggers + prefixes
  18. */
  19. logger.debug("Debugging Msg");
  20. logger.info("Info statement");
  21. logger.warn("A little warning with string %s", "substitution");
  22. logger.error("an error occurred in file: {red:%s}", "/users/awesomedev/file.js");
  23. ```
  24. ```js
  25. /**
  26. * Use string substitution + colours
  27. */
  28. logger.log("error", "Use {green:built-in} %s", "String substitution");
  29. ```
  30. ```js
  31. /**
  32. * Set an option for the next log statement only
  33. */
  34. logger.setOnce("useLevelPrefixes", true).warn("Use {green:built-in} %s", "String substitution");
  35. ```