New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

beautiful-log

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beautiful-log

Because logging should be beautiful.

  • 2.0.0-1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
1
Weekly downloads
 
Created
Source

beautiful-log

Because logging should be easy and beautiful.

Installation

npm install beautiful-log

Usage

beautiful-log requires rest arguments in order to run properly. This means that you must either use Node 6.x (in which rest arguments are enabled by defualt) or run with the --harmony flag.

var log = require("beautiful-log");



////////// Basic Logging //////////

log.log("log (default)");
log.info("info (blue)");
log.warn("warn (yellow)");
log.error("error (red)");
log.verbose("verbose (gray/grey)");
log.ok("ok (green)");

log.log("<magenta>Color tags are also supported <black>(even nested)</black> in log calls!</magenta>");
// Default names: default, black, red, green, yellow, blue, magenta, cyan, white, gray/grey.

log.log("<#af00af>This color is purple af</#af00af>");
// You can also pass any hex color, which gets approximated for your terminal.

log.addColor("veljean", "#024601");
// You can also name your own colors...

log.log("<veljean>Your time is up and your parole's begun</veljean>")
// ...and use them just like the prenamed ones.

log.addColor("gray", "#333333");
// You can even overwrite the default ones if you don't like them.

log.log({ objects: "can be logged as well, and are colorful", colorful: true });
// This is done via util.inspect(), so whatever color settings you have for that will be preserved.

// No matter how you log, the function name, file name, and line number from which you logged are logged as well.



////////// Formatting and Saved Formats //////////

log.logf("You can %s", "use format strings, too.");
// Formatting is powered by sprintf-js, so anything that's valid there is valid here.

log.addFormat("date", "%s %2d, %4d");
log.logf("date", "October", 23, 2077);
log.logf("date", "January", 1, 2000);
// You can also store a format string so you don't have to pass it many times.



////////// Other features //////////

log.divider("DIVIDE");
// Prints a divider that looks like "###### DIVIDE ######", expanding to fill the full console width.

log.divider("-D-I-V-I-D-E-", "-");
// You can also pass a different divider character.

log.timestamp();
// Prints the current time.

log.line();
// Prints an empty line.

log.line(2);
// Prints many empty lines.

log.indent();
log.log("This text is indented one level.");
log.log("All text will be indented until the unindent is called.")
log.indent();
log.log("Multiple indentation levels work.");
log.unindent(2);
log.log("You can also pass a parameter to indent/unindent multiple times in one call.");

FAQs

Package last updated on 18 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc