finished logger paths and details

This commit is contained in:
bill bittner 2017-06-19 20:22:23 -07:00
parent 5f7177540c
commit dd70c19b64
9 changed files with 26 additions and 25 deletions

View file

@ -10,7 +10,7 @@
"PublishUploadPath": "none"
},
"Logging": {
"LogLevel": "silly",
"LogDirectory": "C:\\lbry\\speech\\logs\\"
"LogLevel": "none",
"LogDirectory": "none"
}
}

View file

@ -10,6 +10,7 @@
"PublishUploadPath": "C:\\lbry\\speech\\hosted_content"
},
"Logging": {
"LogLevel": "debug"
"LogLevel": "debug",
"LogDirectory": "C:\\lbry\\speech\\logs\\"
}
}

View file

@ -10,6 +10,7 @@
"PublishUploadPath": "/home/lbry/Downloads/"
},
"Logging": {
"LogLevel": "verbose"
"LogLevel": "debug",
"LogDirectory": "/home/lbry/Logs"
}
}

View file

@ -10,6 +10,7 @@
"PublishUploadPath": "/home/ubuntu/Downloads/"
},
"Logging": {
"LogLevel": "info"
"LogLevel": "debug",
"LogDirectory": "/home/ubuntu/Logs"
}
}

View file

@ -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 });
})

View file

@ -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

View file

@ -1,5 +1,4 @@
const fs = require('fs');
const tsFormat = () => (new Date()).toLocaleTimeString();
module.exports = (winston, logLevel, logDir) => {
if (!fs.existsSync(logDir)) {
@ -18,18 +17,15 @@ module.exports = (winston, logLevel, logDir) => {
filename : `${logDir}speechLogs.log`,
level : logLevel,
json : false,
timestamp : tsFormat,
timestamp : true,
colorize : true,
prettyPrint: 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');

View file

@ -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: {

View file

@ -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 {