wyrihaximus / react-psr-3-phergie
将Phergie转换为PSR-3日志记录器
1.0.0
2018-01-09 21:32 UTC
Requires
- php: ^7.0
- phergie/phergie-irc-bot-react: ^2.1
- psr/log: ^1.0
- reactivex/rxphp: ^2.0
- wyrihaximus/psr-3-utilities: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.3
- jakub-onderka/php-console-highlighter: ^0.3.2
- jakub-onderka/php-parallel-lint: ^0.9.2
- phake/phake: ^2.3
- phpunit/phpunit: ^5.7.15
This package is auto-updated.
Last update: 2024-09-03 09:50:21 UTC
README
安装
要通过Composer安装,请使用以下命令,它将自动检测最新版本并将其与~
绑定。
composer require wyrihaximus/react-psr-3-phergie
用法
请确保以与示例相同的方式排序一切,这对于将您的IRC密码保持在日志之外非常重要。
// Zero create the ReactPHP Event loop (assuming you don't already did) $loop = Factory::create(); // First create the logger, in this example Monolog is assumed $logger = new Logger('your app'); // Then create the plugin $plugin = new PhergiePSR3Plugin('#logs-channel'); // Thirdly set up your logger the way you like /** * Logger set up magic */ // Fourth add handlers /** * Add any other handlers here, before the fith step, to ensure it * doesn't leak the password */ // Fith wrap the logger in wyrihaximus/psr-3-keyword-filter $logger = new MessageKeywordFilterLogger(['PASS', 'PRIVMSG'], $logger); // Sixth create the Phergie Client $client = new Client(); $client->setLoop($loop); $client->setLogger($logger); // Seventh create the Phergie bot $bot = new Bot(); // Eighth create the Pergie connection $connection = new Connection([ // Your connection config here ]); // Nineth add the config combining the connection and plugin $bot->setConfig([ 'plugins' => [ $loggingPlugin, new EventFilterPlugin([ // phergie/phergie-irc-plugin-react-eventfilter 'filter' => new ConnectionFilter([ $connection, ]), 'plugins' => [ new AutoJoinPlugin([ // phergie/phergie-irc-plugin-react-autojoin 'channels' => [ '#logs-channel', ], ]), ], ]), ], 'connections' => [ $connection, ], ]); // Tenth set the client and run the bot (note that the false is to ensure this doesn't run the event loop) $bot->setClient($client); $bot->run(false);
许可证
版权所有 2018 Cees-Jan Kiewiet
在此特此授予任何获得此软件及其相关文档文件(“软件”)副本的人,免费使用软件的权利,不受任何限制,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,以及允许向软件提供的人行使这些权利,但受以下条件的约束
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论是基于合同、侵权或其他方式,无论是源于、因之或与软件或其使用或其他交易有关。