Skip to content

Commit 4349f27

Browse files
committed
Prepare 4.15.0
1 parent fc859ec commit 4349f27

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,39 @@ The Sentry SDK team is happy to announce the immediate availability of Sentry PH
88

99
- Add Monolog Sentry Logs handler [(#1867)](https://github.com/getsentry/sentry-php/pull/1867)
1010

11-
### Bug Fixes
11+
This new handler allows you to capture Monolog logs as Sentry logs. To use it, configure your Monolog logger:
1212

13-
- Use correct 'sample_rate' key when deriving sampleRand [(#1874)](https://github.com/getsentry/sentry-php/pull/1874)
14-
- Do not call Reflection*::setAccessible() in PHP >= 8.1 [(#1872)](https://github.com/getsentry/sentry-php/pull/1872)
13+
```php
14+
use Monolog\Logger;
15+
use Sentry\Monolog\LogsHandler;
16+
use Sentry\Logs\LogLevel;
17+
18+
// Initialize Sentry SDK first (make sure 'enable_logs' is set to true)
19+
\Sentry\init([
20+
'dsn' => '__YOUR_DSN__',
21+
'enable_logs' => true,
22+
]);
23+
24+
// Create a Monolog logger
25+
$logger = new Logger('my-app');
26+
27+
// Add the Sentry logs handler
28+
// Optional: specify minimum log level (defaults to LogLevel::debug())
29+
$handler = new LogsHandler(LogLevel::info());
30+
$logger->pushHandler($handler);
31+
32+
// Now your logs will be sent to Sentry
33+
$logger->info('User logged in', ['user_id' => 123]);
34+
$logger->error('Payment failed', ['order_id' => 456]);
35+
```
36+
37+
Note: The handler will not collect logs for exceptions (they should be handled separately via `captureException`).
1538

16-
### Misc
39+
### Bug Fixes
1740

18-
- Refactor trace header parsing logic [(#1876)](https://github.com/getsentry/sentry-php/pull/1876)
19-
- Add link to Joomla! integration [(#1868)](https://github.com/getsentry/sentry-php/pull/1868)
41+
- Fix non string indexed attributes passed as log attributes [(#1882)](https://github.com/getsentry/sentry-php/pull/1882)
42+
- Use correct `sample_rate` key when deriving sampleRand [(#1874)](https://github.com/getsentry/sentry-php/pull/1874)
43+
- Do not call `Reflection*::setAccessible()` in PHP >= 8.1 [(#1872)](https://github.com/getsentry/sentry-php/pull/1872)
2044

2145
## 4.14.2
2246

0 commit comments

Comments
 (0)