

telegram-loggerbot-ruby
Allows to send event logs directly to the telegram chat
Installation
Add following line to your Gemfile:
gem 'telegram-loggerbot-ruby'
And then execute:
$ bundle
Or install it system-wide:
gem install telegram-loggerbot-ruby
Usage
- Create new bot with @BotFather and get his TOKEN
- Write something to the new bot (!!!)
- Obtain your TELEGRAM_USER_ID from, for example, @get_id_bot
Require it to your code:
require 'telegram/logger_bot'
Configure with obtained TOKEN and TELEGRAM_USER_ID:
Telegram::LoggerBot.configure do |config|
config.token = 'TOKEN'
config.chat_id = TELEGRAM_USER_ID
end
Create new logger:
logger = Telegram::LoggerBot.new
You can pass events through LoggerBot to your standard logger:
existing_logger = Logger.new(STDOUT)
logger = Telegram::LoggerBot.new(existing_logger)
Log you events:
logger.debug('MyProgram') { "Text of some errors" }
logger.info('MyProgram') { "Text of some errors" }
logger.warn('MyProgram') { "Text of some errors" }
logger.error('MyProgram') { "Text of some errors" }
logger.fatal('MyProgram') { "Text of some errors" }
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request