From 2617c19af9ec233233de93187cbc15d1292da923 Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Sun, 12 Jan 2020 01:58:34 +0300 Subject: [PATCH] feat(telegrambot.ts): use Nest logger --- lib/TelegramBot.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/TelegramBot.ts b/lib/TelegramBot.ts index 6c21f50..faba9ea 100644 --- a/lib/TelegramBot.ts +++ b/lib/TelegramBot.ts @@ -1,4 +1,4 @@ -import { Injectable, Inject } from '@nestjs/common' +import { Injectable, Inject, Logger } from '@nestjs/common' import { ModuleRef } from '@nestjs/core' import Telegraf, { ContextMessageUpdate } from 'telegraf' import { flatten, head } from 'lodash' @@ -15,6 +15,7 @@ import { InvalidConfigurationException } from './InvalidConfigurationException' @Injectable() export class TelegramBot { + private readonly logger = new Logger(TelegramBot.name, true); private readonly sitePublicUrl?: string private readonly bot: Bot private ref: ModuleRef @@ -54,7 +55,7 @@ export class TelegramBot { this.bot.telegram .setWebhook(url) - .then(() => console.log(`Webhook set success @ ${url}`)) + .then(() => Logger.log(`Webhook set success @ ${url}`)) return this.bot.webhookCallback(`/${path}`) }