sitmpcz/sentry-logger
最新稳定版本:v1.7.1
Composer 安装命令:
composer require sitmpcz/sentry-logger
包简介
README 文档
README
Install
composer require sitmpcz/sentry-logger
Sentry event logger usage
-
run Sentry, register your project and get client DSN url
-
in config neon add in section parameters
sentry_url: https://something@abc.sentry.io/someproject
- in config neon add in section services
a) simple version
tracy.logger: Sitmpcz\SentryLogger(%sentry_url%)
b) extended version - use additional attributes (example with release attribute)
tracy.logger: create: Sitmpcz\SentryLogger(%sentry_url%) setup: - setAttribute('release', 'myApp@1.8.0') - setAttribute('environment', 'production')
Manual write to Sentry Error log
Using DI load Sentry Logger Example for presenter
/** @var \Sitmpcz\SentryLogger @inject */ public \Sitmpcz\SentryLogger $sentryLogger;
Then you can write error to Sentry manually:
$this->sentryLogger->log(new \Exception("test sentry"),\Tracy\ILogger::ERROR);
If you want to write to log manually, you can use Tracy\Debugger::log too, but you must specify higher priority (Napr CRITICAL) Example
\Tracy\Debugger::log("Test zapistu do logu",\Tracy\ILogger::CRITICAL);
Sentry performance usage (optional)
Example for Nette - BasePresenter:
private ?object $sentryPerformance = null; function startup(): void { parent::startup(); $this->sentryPerformance = Sitmpcz\SentryPerformance::startPerformaceMonitoring($this->getName(), $this->getAction()); } function shutdown(Nette\Application\Response $response): void { parent::shutdown($response); if ($this->sentryPerformance) Sitmpcz\SentryPerformance::endPerformaceMonitoring($this->sentryPerformance); }
统计信息
- 总下载量: 7.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-01-26