@glennsl/rebug

0.2.2 • Public • Published

rebug

Originally a port of debug to BuckleScript, but has since expanded a bit.

npm Issues Last Commit Size

NOTE: NPM package has moved to @glennsl/rebug. Remember to update both package.json AND bsconfig.json.

Status

  • Browser back-end has been implemented, Node.js back-end has not
  • Formatting isn't properly supported yet
  • Colors are always on
  • Isn't quite as customizable (yet)

Example

/* Reason */

/* creates a logger with the given namespace */
let debug = Debug.make("my:namespace");

/* debug.log* logs the message only if the namespace of the logger is enabled */
debug.log1("The red cow jumps over the lazy giraffe");

/* debug.error* will log the message regardless of whether the namespace is
   enabled, format it as an error and include a stack trace */
try (...) {
| error => a.error2("Error occurred while doing stuff: ", error)
};

/* debug.fn* groups any log output during its execution, and logs the arguments
   passed to and the value returned from the function */
let loggedParse = debug.fn1("JSON.parse", Js.Json.parseExn);

See examples for more.

Installation

npm install --save @glennsl/rebug

Then add @glennsl/rebug to bs-dependencies in your bsconfig.json:

{
  ...
  "bs-dependencies": ["@glennsl/rebug"]
}

Package Sidebar

Install

npm i @glennsl/rebug

Weekly Downloads

0

Version

0.2.2

License

MIT

Last publish

Collaborators

  • glennsl