adds timestamp and relevance to logs
This commit is contained in:
parent
5e92393f48
commit
656b159fce
3 changed files with 7 additions and 10 deletions
|
@ -32,17 +32,16 @@ const claimGet = async ({ ip, originalUrl, params, headers }, res) => {
|
|||
if (!claimDataFromChainquery) {
|
||||
throw new Error('claim/get: resolveClaim: No matching uri found in Claim table');
|
||||
}
|
||||
|
||||
if (headers && headers['user-agent'] && isBot(headers['user-agent'])) {
|
||||
let lbrynetResolveResult = await resolveUri(`${name}#${claimId}`);
|
||||
const { message, completed } = lbrynetResolveResult;
|
||||
logger.info(`ClaimGet Bot: From user-agent: ${headers['user-agent']} for: ${claimId}`);
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
message,
|
||||
message: 'Bot detected',
|
||||
completed: false,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
logger.info(`ClaimGet: From user-agent: ${headers['user-agent']} for: ${claimId}`);
|
||||
|
||||
let lbrynetResult = await getClaim(`${name}#${claimId}`);
|
||||
|
||||
|
@ -59,7 +58,7 @@ const claimGet = async ({ ip, originalUrl, params, headers }, res) => {
|
|||
|
||||
const fileData = await createFileRecordDataAfterGet(claimData, lbrynetResult).catch(() => null);
|
||||
if (!fileData) {
|
||||
logger.info(
|
||||
logger.error(
|
||||
'claim/get: createFileRecordDataAfterGet failed to create file dimensions in time'
|
||||
);
|
||||
}
|
||||
|
@ -70,7 +69,7 @@ const claimGet = async ({ ip, originalUrl, params, headers }, res) => {
|
|||
.catch(() => null);
|
||||
|
||||
if (!upsertResult) {
|
||||
logger.info('claim/get: DB file upsert failed');
|
||||
logger.error('claim/get: DB file upsert failed');
|
||||
}
|
||||
|
||||
const { message, completed } = lbrynetResult;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import logger from 'winston';
|
||||
|
||||
import config from '@config/loggerConfig';
|
||||
const { logLevel } = config;
|
||||
const { logLevel, timeStamp } = config;
|
||||
|
||||
export default function configureLogging() {
|
||||
logger.info('configuring winston logger...');
|
||||
|
@ -16,7 +16,7 @@ export default function configureLogging() {
|
|||
transports: [
|
||||
new logger.transports.Console({
|
||||
level: logLevel || 'debug',
|
||||
timestamp: false,
|
||||
timestamp: true,
|
||||
colorize: true,
|
||||
prettyPrint: true,
|
||||
handleExceptions: true,
|
||||
|
|
|
@ -49,7 +49,6 @@ export default async (data, chName = null, chShortId = null) => {
|
|||
}
|
||||
if (dataFromFileList && dataFromFileList.outpoint) {
|
||||
// file_list values due to recent publish
|
||||
console.log('ClaimName', dataFromFileList.claim_name);
|
||||
return {
|
||||
name: dataFromFileList.claim_name,
|
||||
title: dataFromFileList.metadata.title,
|
||||
|
@ -72,7 +71,6 @@ export default async (data, chName = null, chShortId = null) => {
|
|||
};
|
||||
} else {
|
||||
// chainquery result values
|
||||
console.log('ClaimName', dataFromChainquery.name);
|
||||
return {
|
||||
name: dataFromChainquery.name,
|
||||
title: dataFromChainquery.title,
|
||||
|
|
Loading…
Reference in a new issue