mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-16 12:21:28 +03:00
changed logging in backend to support extra logging in debug mode
This commit is contained in:
@@ -42,7 +42,7 @@ const defaultFormat = winston.format.printf(({ level, message, label, timestamp
|
|||||||
return `${timestamp} ${level.toUpperCase()}: ${message}`;
|
return `${timestamp} ${level.toUpperCase()}: ${message}`;
|
||||||
});
|
});
|
||||||
const logger = winston.createLogger({
|
const logger = winston.createLogger({
|
||||||
level: !debugMode ? 'info' : 'debug',
|
level: 'info',
|
||||||
format: winston.format.combine(winston.format.timestamp(), defaultFormat),
|
format: winston.format.combine(winston.format.timestamp(), defaultFormat),
|
||||||
defaultMeta: {},
|
defaultMeta: {},
|
||||||
transports: [
|
transports: [
|
||||||
@@ -52,7 +52,7 @@ const logger = winston.createLogger({
|
|||||||
//
|
//
|
||||||
new winston.transports.File({ filename: 'appdata/logs/error.log', level: 'error' }),
|
new winston.transports.File({ filename: 'appdata/logs/error.log', level: 'error' }),
|
||||||
new winston.transports.File({ filename: 'appdata/logs/combined.log' }),
|
new winston.transports.File({ filename: 'appdata/logs/combined.log' }),
|
||||||
new winston.transports.Console({level: 'info'})
|
new winston.transports.Console({level: !debugMode ? 'info' : 'debug'})
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ async function downloadReleaseFiles(tag) {
|
|||||||
} else if (!is_dir && !replace_ignore_list.includes(fileName)) {
|
} else if (!is_dir && !replace_ignore_list.includes(fileName)) {
|
||||||
// get package.json
|
// get package.json
|
||||||
var actualFileName = fileName.replace('youtubedl-material/', '');
|
var actualFileName = fileName.replace('youtubedl-material/', '');
|
||||||
if (debugMode) logger.verbose('Downloading file ' + actualFileName);
|
logger.verbose('Downloading file ' + actualFileName);
|
||||||
entry.pipe(fs.createWriteStream(path.join(__dirname, actualFileName)));
|
entry.pipe(fs.createWriteStream(path.join(__dirname, actualFileName)));
|
||||||
} else {
|
} else {
|
||||||
entry.autodrain();
|
entry.autodrain();
|
||||||
@@ -568,7 +568,7 @@ function watchSubscriptions() {
|
|||||||
let current_delay = 0;
|
let current_delay = 0;
|
||||||
for (let i = 0; i < subscriptions.length; i++) {
|
for (let i = 0; i < subscriptions.length; i++) {
|
||||||
let sub = subscriptions[i];
|
let sub = subscriptions[i];
|
||||||
logger.debug('watching ' + sub.name + ' with delay interval of ' + delay_interval);
|
logger.verbose('Watching ' + sub.name + ' with delay interval of ' + delay_interval);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
subscriptions_api.getVideosForSub(sub);
|
subscriptions_api.getVideosForSub(sub);
|
||||||
}, current_delay);
|
}, current_delay);
|
||||||
|
|||||||
@@ -215,14 +215,14 @@ async function getVideosForSub(sub) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get videos
|
// get videos
|
||||||
|
logger.verbose('Subscribe: getting videos for subscription ' + sub.name);
|
||||||
youtubedl.exec(sub.url, downloadConfig, {}, function(err, output) {
|
youtubedl.exec(sub.url, downloadConfig, {}, function(err, output) {
|
||||||
logger.verbose('Subscribe: got videos for subscription ' + sub.name);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err.stderr);
|
logger.error(err.stderr);
|
||||||
resolve(false);
|
resolve(false);
|
||||||
} else if (output) {
|
} else if (output) {
|
||||||
if (output.length === 0 || (output.length === 1 && output[0] === '')) {
|
if (output.length === 0 || (output.length === 1 && output[0] === '')) {
|
||||||
logger.debug('No additional videos to download for ' + sub.name);
|
logger.verbose('No additional videos to download for ' + sub.name);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}
|
}
|
||||||
for (let i = 0; i < output.length; i++) {
|
for (let i = 0; i < output.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user