Telegram bot library feats Monolog to store logs.
Logs are divided in those streams:
Collects all the exceptions throwned by the library:
TelegramLog::initErrorLog($path . '/' . $BOT_NAME . '_error.log');
Stores Curl messages with the server, useful for debugging:
TelegramLog::initDebugLog($path . '/' . $BOT_NAME . '_debug.log');
Incoming updates (json string from webhook and getUpdates) can be logged in a text file. Set this option with the methods:
TelegramLog::initUpdateLog($path . '/' . $BOT_NAME . '_update.log');
Why I need raw log?
Telegram api changes continuously and often happen that db schema is not uptodate with new entities/features. So can happen that your table schema would not be able to store valuable new information coming from Telegram.
If you store raw data you can port all updates on the newest table schema just using this script. Remember always backup first!!
Error and Debug streams relies on the bot_log
instance that can be provided from an external source:
TelegramLog::initialize($monolog);
Raw data relies on the bot_update_log
instance that feats a custom format for this kind of logs.