voodoosms/datadog-logging
最新稳定版本:v2.0.2
Composer 安装命令:
composer require voodoosms/datadog-logging
包简介
Adds datadog logging stack for Laravel
README 文档
README
Installation
composer require voodoosms/datadog-logging
Usage
You need to set up some env variables for this to work:
DATADOG_APIKEY=
DATADOG_LOGGING_URL=tcp-intake.logs.datadoghq.eu
DATADOG_LOGGING_PORT=1883
DATADOG_LOGGING_SOURCE=
DATADOG_LOGGING_SERVICE=
DATADOG_LOGGING_TAGS=
Then you can use it using Laravel's Log facade:
Log::channel('datadog')->info('message here')
You should set the name of the event when logging with this though:
Log::channel('datadog')->info('message here', ['event' => 'some event'])
Anything passed into the array will also be included as a field in the datadog log:
Log::channel('datadog')->info('message here', ['event' => 'some event', 'user' => $user])
Logs are sent to datadog using telnet, so the DatadogLoggerHandler dispatches a SendDatadogLogJob, so you will need a queue worker running for these logs to get to datadog, using the queue datadog:
php artisan queue:work --queue=datadog
Alternatively, you can send these logs synchronously by adding 'ddqueue' => false to the log context:
Log::channel('datadog')->info('message here', ['ddqueue' => false])
You can also use the datadog helper function to quickly send a log:
datadog('test', ['user' => $user]);
统计信息
- 总下载量: 4.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-28