Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

log-output

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log-output

Persist log messages on the command line.

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

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

Deprecation notice :rotating_light:

I strongly suggest you to move to log-update that came out a little after I first wrote this module. It's really complete and making the switch should be really easy. Also, PhantomJS 2.1 has finally came out solving the problems I was trying to work around with this module.

log-output Unmaintained Project

Persist log messages on the command line.

Formerly write.js.

Install

$ npm install --save log-output

Usage

var logOutput = require('log-output');
var frames = 'lorem ipsum dolor sit'.split(' ');
var frame = 0;

setInterval(function() {
  frame = frames[frame++ % frames.length];
  logOutput(frames[frame]);
}, 1000);

API

logOutput(message)

message

Required
Type: string

Output message.

logOutput.stream()

Type: Stream object

Specify a stream to output.

logOutput.adapter()

Specify a writable stream interface, which is essentially an adapter.

The interface must implement the following API:

  • resetLine() - Reset current output line
  • newLine() - Add a new output line
  • resetCursor([position]) - Reset cursor position (position defaults to 0)
  • output(message) - Output message

Official adapters are:

You can specify your own:

var logOutput = require('log-output');
var customAdapter = function() {
  // Assuming you have a custom stream with a non-standard interface
  var stream = require('custom-stream');

  return {
    resetLine: function() {},
    newLine: function() {},
    resetCursor: function(position) {},
    output: function() {}
  }
};

logOutput.adapter(customAdapter);
logOutput('yay'); // yay

logOutput.clear()

Shortcut to empty current output.

logOutput.done()

Shortcut to output a new line.

Motivation

I wanted to visually persist log messages on the command line. Turns out this can be a bit tricky, that's why I have created this module.

Thoughts on log-update

log-update is essentially the same idea of log-output but it was released later and has no support for stream adapters.
Adapters support was one of the reasons I've created this module in the first place. I needed a way to persist the log messages within a PhantomJS instance.

License

MIT © Rafael Rinaldi

Keywords

FAQs

Package last updated on 04 Feb 2016

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