|
9 | 9 | use Illuminate\Foundation\Console\AboutCommand; |
10 | 10 | use Illuminate\Foundation\Http\Kernel as HttpKernel; |
11 | 11 | use Illuminate\Http\Request; |
12 | | -use Illuminate\Log\LogManager; |
13 | | -use Illuminate\Support\Facades\Config; |
14 | 12 | use Laravel\Lumen\Application as Lumen; |
15 | 13 | use RuntimeException; |
16 | | -use Sentry\Client; |
17 | 14 | use Sentry\ClientBuilder; |
18 | 15 | use Sentry\ClientBuilderInterface; |
19 | 16 | use Sentry\Event; |
|
26 | 23 | use Sentry\Laravel\Http\LaravelRequestFetcher; |
27 | 24 | use Sentry\Laravel\Http\SetRequestIpMiddleware; |
28 | 25 | use Sentry\Laravel\Http\SetRequestMiddleware; |
| 26 | +use Sentry\Laravel\Tracing\BacktraceHelper; |
29 | 27 | use Sentry\Laravel\Tracing\ServiceProvider as TracingServiceProvider; |
30 | 28 | use Sentry\SentrySdk; |
| 29 | +use Sentry\Serializer\RepresentationSerializer; |
31 | 30 | use Sentry\State\Hub; |
32 | 31 | use Sentry\State\HubInterface; |
33 | 32 | use Sentry\Tracing\TransactionMetadata; |
@@ -55,6 +54,7 @@ class ServiceProvider extends BaseServiceProvider |
55 | 54 | * List of features that are provided by the SDK. |
56 | 55 | */ |
57 | 56 | protected const FEATURES = [ |
| 57 | + Features\LogIntegration::class, |
58 | 58 | Features\CacheIntegration::class, |
59 | 59 | Features\QueueIntegration::class, |
60 | 60 | Features\ConsoleIntegration::class, |
@@ -113,12 +113,6 @@ public function register(): void |
113 | 113 |
|
114 | 114 | $this->configureAndRegisterClient(); |
115 | 115 |
|
116 | | - if (($logManager = $this->app->make('log')) instanceof LogManager) { |
117 | | - $logManager->extend('sentry', function ($app, array $config) { |
118 | | - return (new LogChannel($app))($config); |
119 | | - }); |
120 | | - } |
121 | | - |
122 | 116 | $this->registerFeatures(); |
123 | 117 | } |
124 | 118 |
|
@@ -159,16 +153,12 @@ protected function registerFeatures(): void |
159 | 153 | $this->app->singleton($feature); |
160 | 154 | } |
161 | 155 |
|
162 | | - $bootActive = $this->hasDsnSet(); |
163 | | - |
164 | 156 | foreach (self::FEATURES as $feature) { |
165 | 157 | try { |
166 | 158 | /** @var Feature $featureInstance */ |
167 | 159 | $featureInstance = $this->app->make($feature); |
168 | 160 |
|
169 | | - $bootActive |
170 | | - ? $featureInstance->register() |
171 | | - : $featureInstance->registerInactive(); |
| 161 | + $featureInstance->register(); |
172 | 162 | } catch (Throwable $e) { |
173 | 163 | // Ensure that features do not break the whole application |
174 | 164 | } |
@@ -340,6 +330,14 @@ protected function configureAndRegisterClient(): void |
340 | 330 | }); |
341 | 331 |
|
342 | 332 | $this->app->alias(HubInterface::class, static::$abstract); |
| 333 | + |
| 334 | + $this->app->singleton(BacktraceHelper::class, function () { |
| 335 | + $sentry = $this->app->make(HubInterface::class); |
| 336 | + |
| 337 | + $options = $sentry->getClient()->getOptions(); |
| 338 | + |
| 339 | + return new BacktraceHelper($options, new RepresentationSerializer($options)); |
| 340 | + }); |
343 | 341 | } |
344 | 342 |
|
345 | 343 | /** |
|
0 commit comments