helissonms/monolog-datadog
最新稳定版本:v3.0.0
Composer 安装命令:
composer require helissonms/monolog-datadog
包简介
Monolog Handler for Datadog Logs
README 文档
README
Datadog Monolog integration
MonologDatadog is a Datadog Log handler for Monolog. It enables you to send logs directly to HTTP with Curl.
Requirements
- Datadog Account
- Datadog Api Key
- Php 7.1+
- Php-curl
Features
- Send Monolog logs directly to HTTP with Curl
- Automatically JSON Formatted
Installation
Install the latest version with
composer require helissonms/monolog-datadog
Basic Usage
<?php use Monolog\Logger; use MonologDatadog\Handler\DatadogHandler; // Add your [Datadog Api Key] $apiKey = 'YOUR-DATADOG-API-KEY'; $attributes = [ 'hostname' => 'YOUR_HOSTNAME', // Default: $_SERVER['SERVER_NAME'] 'source' => 'php', // Default: php 'service' => 'YOUR-SERVICE' // Default: Monolog channel name ]; $logger = new Logger('datadog-channel'); $datadogLogs = new DatadogHandler($apiKey, $attributes, Logger::INFO); $logger->pushHandler($datadogLogs); $logger->info('i am an info'); $logger->warning('i am a warning..'); $logger->error('i am an error '); $logger->notice('i am a notice'); $logger->emergency('i am an emergency');
统计信息
- 总下载量: 1.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-20