drewjoh/sentry

该包的最新版本(0.2.0)没有可用的许可证信息。

Sentry 的 PHP 封装器

0.2.0 2012-11-20 18:06 UTC

This package is not auto-updated.

Last update: 2024-09-28 14:17:20 UTC


README

这是一个简单的包装类,用于 raven-php 实验性 PHP 客户端 Sentry

我更喜欢在我的应用程序中使用简单的静态方法来完成诸如日志记录等任务。这个包装器使得这一功能可行,而不是每次需要时都要创建客户端实例。

用法

// Setup our class, with optional persistent tags
Sentry::setDSN('{YOUR_DSN}', array('php_version' => phpversion()) );

// Capture a message
$event_id = Sentry::captureMessage('my log message');

// Capture an exception
$event_id = Sentry::captureException($exception);

// Capture with one time use tags
Sentry::tags(array('test_tag' => 'true'));
Sentry::captureMessage('Test message 3 from Sentry class');

// Give the user feedback
echo "Sorry, there was an error! Your reference ID is " . $event_id;

安装

使用 Composer 安装

如果您使用 Composer 管理依赖项,您可以通过它添加 Raven。

{
    "require": {
        "drewjoh/Sentry": ">=0.1.0"
    }
}