Skip to content

Commit

Permalink
use the logger module in the graphite backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Schauenberg committed Jan 17, 2013
1 parent 53aae0a commit 4379e46
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backends/graphite.js
Expand Up @@ -13,7 +13,10 @@
*/

var net = require('net'),
util = require('util');
logger = require('../lib/logger');

// this will be instantiated to the logger
var l;

var debug;
var flushInterval;
Expand Down Expand Up @@ -46,7 +49,7 @@ var post_stats = function graphite_post_stats(statString) {
var graphite = net.createConnection(graphitePort, graphiteHost);
graphite.addListener('error', function(connectionException){
if (debug) {
util.log(connectionException);
l.log(connectionException);
}
});
graphite.on('connect', function() {
Expand All @@ -60,7 +63,7 @@ var post_stats = function graphite_post_stats(statString) {
});
} catch(e){
if (debug) {
util.log(e);
l.log(e);
}
graphiteStats.last_exception = Math.round(new Date().getTime() / 1000);
}
Expand Down Expand Up @@ -148,6 +151,7 @@ var backend_status = function graphite_status(writeCb) {
};

exports.init = function graphite_init(startup_time, config, events) {
l = new logger.Logger(config.log || {});
debug = config.debug;
graphiteHost = config.graphiteHost;
graphitePort = config.graphitePort;
Expand Down

0 comments on commit 4379e46

Please sign in to comment.