fix(log): color log (part 3)

This commit is contained in:
Alexey Kasyanchuk
2018-08-07 02:41:28 +03:00
parent bf62a2de16
commit 9981c97065
5 changed files with 38 additions and 38 deletions

View File

@ -17,7 +17,7 @@ torrentClient.saveSession = (sessionFile) => {
torrentClient.loadSession = (sessionFile) => {
if(!fs.existsSync(sessionFile))
{
console.log('no download sessions - ignore')
logT('downloader', 'no download sessions - ignore')
return
}
@ -25,26 +25,26 @@ torrentClient.loadSession = (sessionFile) => {
const obj = JSON.parse(data);
if(!obj.torrents)
{
console.log('no torrents list for loading session')
logT('downloader', 'no torrents list for loading session')
return
}
if(!torrentClient._add)
{
console.log('no overriden _add() method')
logT('downloader', 'no overriden _add() method')
return
}
const {torrents} = obj
torrents.forEach(({torrent, infoHash, path, removeOnDone, paused}) => {
if(!torrent || !infoHash || !path)
{
console.log('no info for starting download this torrent')
logT('downloader', 'no info for starting download this torrent')
return
}
console.log('restore download session:', torrent.name)
logT('downloader', 'restore download session:', torrent.name)
const download = torrentClient._add(torrent, path)
if(download)
{
console.log('restore options')
logT('downloader', 'restore options')
// restore options
download.removeOnDone = removeOnDone
if(paused)