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

amino-log

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

amino-log - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

8

daemon.js

@@ -15,3 +15,7 @@ function list (str) {

amino.subscribe('log:stdout', console.log);
amino.subscribe('log:stderr', console.error);
amino.subscribe('log:stdout', function (args) {
console.log.apply(console, args);
});
amino.subscribe('log:stderr', function (args) {
console.error.apply(console, args);
});

@@ -1,15 +0,21 @@

var format = require('util').format;
exports.attach = function (options) {
var amino = this;
amino.log = function (message, vars, channel) {
if (typeof vars === 'string') {
channel = vars;
vars = [];
amino.log = function () {
var args = [].slice.call(arguments);
amino.publish('log:stdout', args);
if (!options.quiet) {
console.log.apply(console, args);
}
if (!vars) vars = [];
if (!channel) channel = 'stdout';
amino.publish('log:' + channel, format.apply(null, [message].concat(vars)));
};
amino.warn = amino.log;
amino.error = function () {
var args = [].slice.call(arguments);
amino.publish('log:stderr', args);
if (!options.quiet) {
console.error.apply(console, args);
}
};
};
{
"name": "amino-log",
"version": "0.0.1",
"version": "0.1.0",
"description": "logging daemon for amino applications",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ describe('basic test', function () {

amino
.use(plugin)
.use(plugin, {quiet: true})
.init();

@@ -14,3 +14,3 @@ daemon = child_process.spawn(path.resolve(__dirname, '../bin/amino-log'));

it('stdout', function (done) {
it('log', function (done) {
daemon.stdout.once('data', function (chunk) {

@@ -25,3 +25,13 @@ assert.equal(chunk.toString(), 'something!\n');

it('stderr', function (done) {
it('warn', function (done) {
daemon.stdout.once('data', function (chunk) {
assert.equal(chunk.toString(), 'blah...\n');
done();
});
setTimeout(function () {
amino.warn('blah...');
}, 200);
});
it('error', function (done) {
daemon.stderr.once('data', function (chunk) {

@@ -32,3 +42,3 @@ assert.equal(chunk.toString(), 'dude!\n');

setTimeout(function () {
amino.log('dude!', 'stderr');
amino.error('dude!');
}, 200);

@@ -43,5 +53,5 @@ });

setTimeout(function () {
amino.log('hello %s', ['stupid'], 'stderr');
amino.error('hello %s', ['stupid']);
}, 200);
});
});
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