Removed old logging library

This commit is contained in:
Chris Troutner
2019-06-18 20:27:11 -07:00
parent b8f96bf90c
commit 45f430bc7e
10 changed files with 16 additions and 83 deletions
+7 -5
View File
@@ -10,7 +10,6 @@ const router = express.Router()
const axios = require("axios")
const routeUtils = require("./route-utils")
const logger = require("./logging.js")
const wlogger = require("../../util/winston-logging")
// Used to convert error messages to strings, to safely pass to users.
@@ -204,7 +203,7 @@ async function getBlockHeaderBulk(req, res, next) {
})
}
logger.debug(
wlogger.debug(
`Executing blockchain/getBlockHeaderBulk with these hashes: `,
hashes
)
@@ -385,7 +384,7 @@ async function getMempoolEntryBulk(req, res, next) {
})
}
logger.debug(
wlogger.debug(
`Executing blockchain/getMempoolEntry with these txids: `,
txids
)
@@ -641,7 +640,10 @@ async function getTxOutProofBulk(req, res, next) {
}
}
logger.debug(`Executing blockchain/getTxOutProof with these txids: `, txids)
wlogger.debug(
`Executing blockchain/getTxOutProof with these txids: `,
txids
)
// Loop through each txid and creates an array of requests to call in parallel
const promises = txids.map(async txid => {
@@ -826,7 +828,7 @@ async function verifyTxOutProofBulk(req, res, next) {
}
}
logger.debug(
wlogger.debug(
`Executing blockchain/verifyTxOutProof with these proofs: `,
proofs
)
-1
View File
@@ -4,7 +4,6 @@ const express = require("express")
const router = express.Router()
const axios = require("axios")
const logger = require("./logging.js")
const routeUtils = require("./route-utils")
const wlogger = require("../../util/winston-logging")
+6 -1
View File
@@ -1,3 +1,8 @@
/*
This health-check API can be used to test the server for aliveness and
readiness.
*/
"use strict"
const express = require("express")
@@ -5,7 +10,7 @@ const router = express.Router()
/* GET home page. */
router.get("/", (req, res, next) => {
res.json({ status: "winning v2" })
res.json({ status: true })
})
module.exports = router
-15
View File
@@ -1,15 +0,0 @@
"use strict"
const express = require("express")
const router = express.Router()
/* GET home page. */
router.get("/", (req, res, next) => {
res.render("swagger-v2")
})
router.get("/v2", (req, res, next) => {
res.render("swagger-v2")
})
module.exports = router
-51
View File
@@ -1,51 +0,0 @@
/*
A utility library for setting up greylog2 logging.
*/
"use strict"
// This will be uncommented and correct once we have our logging server functioning.
/*
var graylog2 = require("graylog2");
var logger = new graylog2.graylog({
servers: [
{ 'host': '127.0.0.1', port: 12201 },
{ 'host': '127.0.0.2', port: 12201 }
],
hostname: 'server.name', // the name of this host
// (optional, default: os.hostname())
facility: 'Node.js', // the facility for these log messages
// (optional, default: "Node.js")
bufferSize: 1350 // max UDP packet size, should never exceed the
// MTU of your system (optional, default: 1400)
});
logger.on('error', function (error) {
console.error('Error while trying to write to graylog2:', error);
});
*/
// This is just a placeholder function that will be replaced once we get the
// greylog server working.
function log(msg, obj) {
//console.log(msg, obj)
}
// This is just a placeholder function that will be replaced once we get the
// greylog server working.
function error(msg, obj) {
if (!obj) console.error(msg)
else console.error(msg, obj)
}
// This is just a placeholder function that will be replaced once we get the
// greylog server working.
function debug(msg, obj) {
//console.log(msg, obj)
}
module.exports = {
log,
error,
debug
}
-1
View File
@@ -5,7 +5,6 @@ const router = express.Router()
const axios = require("axios")
const routeUtils = require("./route-utils")
const logger = require("./logging.js")
const wlogger = require("../../util/winston-logging")
// Used to convert error messages to strings, to safely pass to users.
-1
View File
@@ -5,7 +5,6 @@ const router = express.Router()
const axios = require("axios")
const routeUtils = require("./route-utils")
const logger = require("./logging.js")
const wlogger = require("../../util/winston-logging")
// Used to convert error messages to strings, to safely pass to users.
+2 -3
View File
@@ -5,7 +5,6 @@ const router = express.Router()
const axios = require("axios")
const routeUtils = require("./route-utils")
const logger = require("./logging.js")
const strftime = require("strftime")
const wlogger = require("../../util/winston-logging")
@@ -812,7 +811,7 @@ async function validateBulk(req, res, next) {
})
}
logger.debug(`Executing slp/validate with these txids: `, txids)
wlogger.debug(`Executing slp/validate with these txids: `, txids)
// Validate each txid
const validatePromises = txids.map(async txid => {
@@ -865,7 +864,7 @@ async function validateSingle(req, res, next) {
return res.json({ error: "txid can not be empty" })
}
logger.debug(`Executing slp/validate/:txid with this txid: `, txid)
wlogger.debug(`Executing slp/validate/:txid with this txid: `, txid)
// Validate txid
// Dev note: must call module.exports to allow stubs in unit tests.
+1 -2
View File
@@ -5,7 +5,6 @@ const router = express.Router()
const axios = require("axios")
const routeUtils = require("./route-utils")
const logger = require("./logging.js")
const wlogger = require("../../util/winston-logging")
const BITBOXJS = require("@chris.troutner/bitbox-js")
@@ -122,7 +121,7 @@ async function validateAddressBulk(req, res, next) {
}
}
logger.debug(`Executing util/validate with these addresses: `, addresses)
wlogger.debug(`Executing util/validate with these addresses: `, addresses)
const {
BitboxHTTP,
-3
View File
@@ -7,7 +7,6 @@
const express = require("express")
const requestUtils = require("./services/requestUtils")
const axios = require("axios")
const logger = require("./logging.js")
const routeUtils = require("./route-utils")
const wlogger = require("../../util/winston-logging")
@@ -48,7 +47,6 @@ async function fromXPubSingle(req, res, next) {
})
}
logger.debug(`Executing address/fromXPub with this xpub: `, xpub)
wlogger.debug(`Executing address/fromXPub with this xpub: `, xpub)
const cashAddr = BITBOX.Address.fromXPub(xpub, hdPath)
@@ -67,7 +65,6 @@ async function fromXPubSingle(req, res, next) {
}
// Write out error to error log.
//logger.error(`Error in rawtransactions/decodeRawTransaction: `, err)
wlogger.error(`Error in address.ts/fromXPubSingle().`, err)
res.status(500)