Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the best way to implement Winston logger as a Telebot's middleware ? #185

Open
ponsfrilus opened this issue Sep 17, 2020 · 1 comment

Comments

@ponsfrilus
Copy link

I was wondering if someone has already used Winston as a Telebot's logger middleware, because I'm not sure of the best way to do it: as a plugin, modifier, or just listen to every bot's events.

Any comments, opinions and remark on this matter would be much appreciated, thanks !

@cikaldev
Copy link

cikaldev commented Mar 7, 2021

You may listen the bot event, then write it on your logger.

// for any command
bot.on('/*', msg => {
  // run logger here
})

// for any incoming text
bot.on('text', msg => {
  // run logger here
})

PS: i'm not using logger for my own project, better to forward the log into my own telegram account for quick action and response 😋 IMHO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants