From 4379e46a5b1eb9088b102be490cd5ef44e815b0e Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Thu, 17 Jan 2013 14:32:08 +0100 Subject: [PATCH] use the logger module in the graphite backend --- backends/graphite.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backends/graphite.js b/backends/graphite.js index d72d477c..7a4d83e6 100644 --- a/backends/graphite.js +++ b/backends/graphite.js @@ -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; @@ -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() { @@ -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); } @@ -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;