-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Feature request #15
Comments
Please add some extra explanations for each bit 👍
So every request does an extra request for the webhook info?
Will be done 🎉
This one is easy to implement, just need to know what options you'd like to have in here, as I'm not very familiar with Botan.
As in, define a maximum size of log file before it gets rotated? Or line count?
So that admins get a message every time an exception happens? |
What I mean is manager.php a=info that shows the webhook info.
Simply array for options that will be passed to enableBotan()
Well, let the user choose in this case:
This I meant as a addition to rotator, maybe the user could specify if he wants the log to be sent when it reaches xx size, xx lines or becomes xx seconds old or send log that got rotated and archived. |
As for the config array, I've put some thought into it and have come up with this merged version of your ideas with mine. $config = [
// Basics
'api_key' => getenv('BOT_API_KEY'),
'bot_username' => getenv('BOT_USERNAME'),
'secret' => getenv('BOT_SECRET'),
// Paths
'paths' => [
'download' => ROOT_PATH . '/download/',
'upload' => ROOT_PATH . '/upload/',
],
// Database
'mysql' => [
'host' => getenv('DB_HOST'),
'user' => getenv('DB_USER'),
'password' => getenv('DB_PASS'),
'database' => getenv('DB_NAME'),
//'table_prefix' => getenv('DB_TABLE_PREFIX'),
//'encoding' => getenv('DB_ENCODING'),
],
// Webhook
'webhook' => [
'url' => getenv('BOT_WEBHOOK'),
//'certificate' => 'certificate.crt',
'max_connections' => 100,
'allowed_updates' => ['message', 'edited_message', 'inline_query', 'chosen_inline_result', 'callback_query'],
],
// Logging
'logging' => [
'error' => ROOT_PATH . '/logs/Error.log',
//'debug' => ROOT_PATH . '/logs/Debug.log',
//'update' => ROOT_PATH . '/logs/Update.log',
],
// Settings
'admins' => [(integer) getenv('BOT_ADMIN')],
// Commands
'commands' => [
'paths' => [
ROOT_PATH . '/Commands/',
],
'configs' => [
'randomcommand' => [
'api_key' => getenv('RANDOM_COMMAND_API_KEY'),
],
],
],
// Extra features
'botan' => [
'token' => getenv('BOTAN_TOKEN'),
'options' => [
'timeout' => 1,
],
],
'limiter' => [
'enabled' => true,
'options' => [
'interval' => 0.5,
],
],
// Cron
'cron' => [
'groups' => [
'default' => [
'/somecommand',
],
'maintenance' => [
'/cleanup',
'/sendlogs',
],
'groupx' => [
'/commandx',
],
],
],
];
Ok, this one could be challenging to make "simple". The more possible options/settings, the more complex everything becomes, obviously. |
Definitely loving cron groups idea! PS. Whoops. |
Oh! Another! It would be nice to be able to pass own PDO instance with Also why we have to use |
Oh just saw this now:
I totally agree with you! The reason why it is as it is at the moment, is that I can use the exact same code to handle CLI input and direct webhook calls. I know that this will change to what you proposed, but first we should establish base commands and then work on a true CLI app that can be packaged as a phar. |
@jacklul Regarding log rotation, Monolog has a very simple rotator, that rotates daily. // instead of
(new StreamHandler(__DIR__ . '/debug.log', Logger::DEBUG))->setFormatter(new LineFormatter(null, null, true)),
// we can use the rotator (keeping 5 days of logs in this example)
(new RotatingFileHandler(__DIR__ . '/debug.log', 5, Logger::DEBUG))->setFormatter(new LineFormatter(null, null, true)), I've been reading online that the best method is to use a dedicated logrotate setup. |
I agree |
Perhaps this will help someone, I use an even simpler mechanism - I specify the date at the beginning of the file name for easy perception, like this: (new Monolog\Handler\StreamHandler(__DIR__ . '/logs/' . date('Y-m-d') . '_error.log', Monolog\Logger::ERROR))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true)), and using cron (that runs daily), I delete logs older than 10 days
|
Great idea @Leonid74 👍 |
webhookinfo
action to get the result ofgetWebhookInfo
. #29The text was updated successfully, but these errors were encountered: