Skip to content

Commit

Permalink
Merge pull request #6 from Mindflash/rf-logging
Browse files Browse the repository at this point in the history
Major logging refactor.
  • Loading branch information
larsenjh authored Oct 10, 2017
2 parents a63e763 + 64f02bb commit 399cdd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ var uuid = require('uuid');

var util = require('util');
var fs = require('fs');
function log(msg) {
fs.writeSync(1, msg + '\n');
}

exports.log = console;

var conns = [];
exports.connect = function (url, name, callback) {
Expand All @@ -17,7 +16,7 @@ exports.connect = function (url, name, callback) {
else {
conn.addListener('ready', readyListener);
conn.addListener('error', function (err) {
console.error('amqp error', err);
exports.log.error('amqp error', err);
// This is fairly terrible and will bring down the whole app if uncaught, but it's better than
// silently going into a rabbit hole. The only thing more terrible is that pun. :)
// We should probably rewrite this and make it an eventEmitter.
Expand All @@ -39,7 +38,7 @@ exports.close = function (url) {
};

function connected(conn, name, callback) {
console.log("connected to", name, "on", conn.serverProperties.product);
exports.log.info("connected to", name, "on", conn.serverProperties.product);

conn.exchange(name + 'Xch', {type: 'fanout', durable: true, autoDelete: false}, function (exchange) {

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"amqputil",
"version":"0.0.24",
"version":"0.0.25",
"description":"A thin wrapper around the amqp node module",
"main":"index.js",
"dependencies":{
Expand Down

0 comments on commit 399cdd2

Please sign in to comment.