Merge pull request #11 from lbryio/log-fix

Fixed logging for elastic
This commit is contained in:
Fillerino 2017-08-18 10:18:06 +02:00 committed by GitHub
commit 1d9e54458f
5 changed files with 28 additions and 5 deletions

View file

@ -49,7 +49,8 @@
"ora": "^1.3.0",
"request": "^2.81.0",
"request-promise": "^4.2.1",
"winston": "^2.3.1"
"winston": "^2.3.1",
"winston-stream": "^0.0.0"
},
"devDependencies": {
"babel-cli": "^6.5.1",

View file

@ -1,10 +1,18 @@
import 'babel-polyfill';
import winston from 'winston';
import winstonStream from 'winston-stream';
import { sync, getStats } from '../utils/importer';
import elasticsearch from 'elasticsearch';
const loggerStream = winstonStream(winston, 'info');
const eclient = new elasticsearch.Client({
host: 'http://elastic:changeme@localhost:9200',
log : 'info',
log : {
level : 'info',
type : 'stream',
stream: loggerStream,
},
});
function getSuggestions (input) {

View file

@ -8,7 +8,7 @@ import winston from 'winston';
// Setup logging
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {colorize: true});
winston.add(winston.transports.Console, { colorize: true, timestamp: true, prettyPrint: true });
// Create Koa Application
const app = new Koa();

View file

@ -3,10 +3,20 @@
*/
const bitcoin = require('bitcoin-promise');
const elasticsearch = require('elasticsearch');
var eclient = new elasticsearch.Client({
const winston = require('winston');
const winstonStream = require('winston-stream');
const loggerStream = winstonStream(winston, 'info');
const eclient = new elasticsearch.Client({
host: 'http://elastic:changeme@localhost:9200',
log : 'info',
log : {
level : 'info',
type : 'stream',
stream: loggerStream,
},
});
const client = new bitcoin.Client({
host : 'localhost',
port : 9245,

View file

@ -3546,6 +3546,10 @@ wide-align@^1.1.0:
dependencies:
string-width "^1.0.2"
winston-stream@^0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/winston-stream/-/winston-stream-0.0.0.tgz#9cd21c9828f688f184768e3fd53254140dca663c"
winston@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/winston/-/winston-2.3.1.tgz#0b48420d978c01804cf0230b648861598225a119"