ermolinme/cloudlog

CloudLog.me 的包

v0.2.0 2023-05-06 07:56 UTC

This package is auto-updated.

Last update: 2024-09-18 08:37:42 UTC


README

CloudLog.me - 是一个简单的日志系统。

使用

仅仅几行代码

$apiToken = YOUR_TOKEN_HERE;
$channelId = YOUR_CHANNEL_ID_HERE; 

$cloudLog = new CloudLog($apiToken);
$cloudLog->channel($channelId);
$cloudLog->tag('my_cool_tag'); //optional
$cloudLog->info('Hello world!', ['foo' => 'bar']);
$cloudLog->error('Whoops!');
$cloudLog->critical('OMG!');

这就完了!

Laravel

您可以将此包用作 Laravel 日志记录器。

php artisan vendor:publish --provider="Ermolinme\CloudLog\CloudLogServiceProvider" --tag="config"

config/logging.php 中创建日志配置

...
'cloud' => [
    'driver' => 'custom',
    'via'    => \Ermolinme\CloudLog\CustomLogger::class,
    'level'  => 'debug',
],
...

并使用它!

Log::channel('cloud')->info('Hello world');