diff --git a/config/default.json b/config/default.json index f8cdc1ca..2b06f70a 100644 --- a/config/default.json +++ b/config/default.json @@ -10,7 +10,7 @@ "PublishUploadPath": "none" }, "Logging": { - "LogLevel": "silly", - "LogDirectory": "C:\\lbry\\speech\\logs\\" + "LogLevel": "none", + "LogDirectory": "none" } } \ No newline at end of file diff --git a/config/development.json b/config/development.json index bfec5f3b..2c64d379 100644 --- a/config/development.json +++ b/config/development.json @@ -10,6 +10,7 @@ "PublishUploadPath": "C:\\lbry\\speech\\hosted_content" }, "Logging": { - "LogLevel": "debug" + "LogLevel": "debug", + "LogDirectory": "C:\\lbry\\speech\\logs\\" } } \ No newline at end of file diff --git a/config/production.json b/config/production.json index 77b5b5b4..7e7e70bb 100644 --- a/config/production.json +++ b/config/production.json @@ -10,6 +10,7 @@ "PublishUploadPath": "/home/lbry/Downloads/" }, "Logging": { - "LogLevel": "verbose" + "LogLevel": "debug", + "LogDirectory": "/home/lbry/Logs" } } diff --git a/config/test.json b/config/test.json index 674075f1..c20a8c16 100644 --- a/config/test.json +++ b/config/test.json @@ -10,6 +10,7 @@ "PublishUploadPath": "/home/ubuntu/Downloads/" }, "Logging": { - "LogLevel": "info" + "LogLevel": "debug", + "LogDirectory": "/home/ubuntu/Logs" } } diff --git a/controllers/publishController.js b/controllers/publishController.js index 09482648..eb1d7660 100644 --- a/controllers/publishController.js +++ b/controllers/publishController.js @@ -44,6 +44,7 @@ module.exports = { lbryApi .publishClaim(publishParams, fileName, fileType) .then(result => { + logger.info(`Successfully published ${fileName}`); visitor.event('Publish Route', 'Publish Success', filePath).send(); socket.emit('publish-complete', { name: claim, result }); }) diff --git a/controllers/serveController.js b/controllers/serveController.js index 8faa7af5..e00daf46 100644 --- a/controllers/serveController.js +++ b/controllers/serveController.js @@ -35,13 +35,14 @@ module.exports = { .then(claim => { // if a matching claim is found locally... if (claim) { + logger.debug(`A mysql record was found for ${claimId}`); // if the outpoint's match return it if (claim.dataValues.outpoint === freePublicClaimOutpoint) { - logger.debug(`local outpoint matched for ${name} ${claimId} `); + logger.debug(`local outpoint matched for ${claimId}`); resolve(claim.dataValues); // if the outpoint's don't match, fetch updated claim } else { - logger.debug(`local outpoint did not match ${name} ${claimId}`); + logger.debug(`local outpoint did not match for ${claimId}`); getClaimAndHandleResponse(freePublicClaimUri, resolve, reject); } // ... otherwise use daemon to retrieve it @@ -73,14 +74,14 @@ module.exports = { .then(claim => { // if a found locally... if (claim) { - logger.debug(`A File record was found for ${claimName}/${claimId}`); + logger.debug(`A mysql record was found for ${claimId}`); // if the outpoint's match return it if (claim.dataValues.outpoint === resolvedOutpoint) { - logger.debug('local outpoint matched'); + logger.debug(`local outpoint matched for ${claimId}`); resolve(claim.dataValues); // if the outpoint's don't match, fetch updated claim } else { - logger.debug('local outpoint did not match'); + logger.debug(`local outpoint did not match for ${claimId}`); getClaimAndHandleResponse(uri, resolve, reject); } // ... otherwise use daemon to retrieve it diff --git a/helpers/logging/loggerSetup.js b/helpers/logging/loggerSetup.js index ce3194d0..cf4fb602 100644 --- a/helpers/logging/loggerSetup.js +++ b/helpers/logging/loggerSetup.js @@ -1,5 +1,4 @@ const fs = require('fs'); -const tsFormat = () => (new Date()).toLocaleTimeString(); module.exports = (winston, logLevel, logDir) => { if (!fs.existsSync(logDir)) { @@ -15,21 +14,18 @@ module.exports = (winston, logLevel, logDir) => { prettyPrint: true, }), new (winston.transports.File)({ - filename : `${logDir}speechLogs.log`, - level : logLevel, - json : false, - timestamp : tsFormat, - colorize : true, - prettyPrint: true, + filename : `${logDir}speechLogs.log`, + level : logLevel, + json : false, + timestamp : true, + colorize : true, + prettyPrint : true, + handleExceptions : true, + humanReadableUnhandledException: true, }), ], }); - winston.handleExceptions(new winston.transports.File({ - filename : `${logDir}uncaughtExceptions.log`, - humanReadableUnhandledException: true, - })); - winston.error('Level 0'); winston.warn('Level 1'); winston.info('Level 2'); diff --git a/routes/serve-routes.js b/routes/serve-routes.js index 5da294df..c3d25814 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -3,7 +3,7 @@ const serveController = require('../controllers/serveController.js'); const logger = require('winston'); function serveFile ({ fileName, fileType, filePath }, res) { - logger.info(`serving file ${fileName} from ${filePath}`); + logger.info(`serving file ${fileName}`); // set default options const options = { headers: { diff --git a/routes/sockets-routes.js b/routes/sockets-routes.js index 4610cba7..0589a58b 100644 --- a/routes/sockets-routes.js +++ b/routes/sockets-routes.js @@ -14,7 +14,7 @@ module.exports = (app, siofu, hostedContentPath, ua, googleAnalyticsId) => { uploader.dir = hostedContentPath; uploader.listen(socket); uploader.on('start', ({ file }) => { - logger.info('Client started an upload', file); + logger.info('client started an upload:', file.name); // server side test to make sure file is not a bad file type if (/\.exe$/.test(file.name)) { uploader.abort(file.id, socket); @@ -26,7 +26,7 @@ module.exports = (app, siofu, hostedContentPath, ua, googleAnalyticsId) => { }); uploader.on('saved', ({ file }) => { if (file.success) { - logger.info(`Client successfully uploaded ${file.name}`); + logger.debug(`Client successfully uploaded ${file.name}`); socket.emit('publish-status', 'file upload successfully completed'); publishController.publish(file.meta.name, file.name, file.pathName, file.meta.type, file.meta.license, file.meta.nsfw, socket, visitor); } else {