From 24ef0a43617c876b0568e6f8020b8b23dd03991c Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Fri, 26 Oct 2018 15:07:20 -0400 Subject: [PATCH] feat(log): replace console logs with pelias-logger This ensures we always get output in JSON if we ask for it. --- helper/geojsonify.js | 4 ++-- index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helper/geojsonify.js b/helper/geojsonify.js index 036fe773..3b209b30 100644 --- a/helper/geojsonify.js +++ b/helper/geojsonify.js @@ -135,8 +135,8 @@ function computeBBox(geojson, geojsonExtentPoints) { geojson.bbox = bbox; } } catch( e ){ - console.error( 'bbox error', e.message, e.stack ); - console.error( 'geojson', JSON.stringify( geojsonExtentPoints, null, 2 ) ); + logger.error( 'bbox error', e.message, e.stack ); + logger.error( 'geojson', geojsonExtentPoints ); } } diff --git a/index.js b/index.js index f541c0cc..aee661f2 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ - +const logger = require('pelias-logger').get('api'); const app = require('./app'), port = ( process.env.PORT || 3100 ), host = ( process.env.HOST || undefined ); @@ -6,5 +6,5 @@ const app = require('./app'), const server = app.listen( port, host, () => { // ask server for the actual address and port its listening on const listenAddress = server.address(); - console.log( `pelias is now running on ${listenAddress.address}:${listenAddress.port}` ); + logger.info( `pelias is now running on ${listenAddress.address}:${listenAddress.port}` ); });