Skip to content

Commit

Permalink
Tweaked logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunoo committed Jul 29, 2020
1 parent 72c814f commit 9bbbe03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FtpMotionPlatform implements DynamicPlatformPlugin {
if (this.config.bot_token) {
const bot = new Telegraf(this.config.bot_token);
bot.catch((err: Error, ctx: Context) => {
this.log.error('[Telegram] Error: Update Type: ' + ctx.updateType + ', Message: ' + err.message);
this.log.error('[Telegram] ' + ctx.updateType + ' Error: ' + err.message);
});
bot.start((ctx) => {
if (ctx.message) {
Expand Down
6 changes: 3 additions & 3 deletions src/motionfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class MotionFS extends FileSystem {
this.log.debug('[' + camera.name + '] [Remote FTP] [' + fileName + '] Uploading file.');
return client.uploadFrom(stream, fileName);
}).then(() => {
this.log.debug('[' + camera.name + '] [Remote FTP] [' + fileName + '] Uploaded file.');
this.log('[' + camera.name + '] [Remote FTP] [' + fileName + '] Uploaded file.');
}).catch((err: Error) => {
this.log.error('[' + camera.name + '] [Remote FTP] [' + fileName + '] Error uploading file: ' + err.message);
}).finally(() => {
Expand All @@ -179,7 +179,7 @@ export class MotionFS extends FileSystem {
this.log.debug('[' + camera.name + '] [Local] [' + fileName + '] Writing file to ' + filePath + '.');
const fileStream = fs.createWriteStream(filePath);
fileStream.on('finish', () => {
this.log.debug('[' + camera.name + '] [Local] [' + fileName + '] Wrote file.');
this.log('[' + camera.name + '] [Local] [' + fileName + '] Wrote file.');
});
fileStream.on('error', (err: Error) => {
this.log.error('[' + camera.name + '] [Local] [' + fileName + '] Error writing file: ' + err.message);
Expand All @@ -195,7 +195,7 @@ export class MotionFS extends FileSystem {
const caption = camera.caption ? { caption: fileName } : {};
this.telegram.sendPhoto(camera.chat_id, { source: stream }, caption)
.then(() => {
this.log.debug('[' + camera.name + '] [Telegram] [' + fileName + '] Sent file.');
this.log('[' + camera.name + '] [Telegram] [' + fileName + '] Sent file.');
});
}
}
Expand Down

0 comments on commit 9bbbe03

Please sign in to comment.