Browse Source

feat(log): replace console logs with pelias-logger

This ensures we always get output in JSON if we ask for it.
pull/1220/head
Julian Simioni 6 years ago
parent
commit
24ef0a4361
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 4
      helper/geojsonify.js
  2. 4
      index.js

4
helper/geojsonify.js

@ -135,8 +135,8 @@ function computeBBox(geojson, geojsonExtentPoints) {
geojson.bbox = bbox; geojson.bbox = bbox;
} }
} catch( e ){ } catch( e ){
console.error( 'bbox error', e.message, e.stack ); logger.error( 'bbox error', e.message, e.stack );
console.error( 'geojson', JSON.stringify( geojsonExtentPoints, null, 2 ) ); logger.error( 'geojson', geojsonExtentPoints );
} }
} }

4
index.js

@ -1,4 +1,4 @@
const logger = require('pelias-logger').get('api');
const app = require('./app'), const app = require('./app'),
port = ( process.env.PORT || 3100 ), port = ( process.env.PORT || 3100 ),
host = ( process.env.HOST || undefined ); host = ( process.env.HOST || undefined );
@ -6,5 +6,5 @@ const app = require('./app'),
const server = app.listen( port, host, () => { const server = app.listen( port, host, () => {
// ask server for the actual address and port its listening on // ask server for the actual address and port its listening on
const listenAddress = server.address(); 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}` );
}); });

Loading…
Cancel
Save