You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Laravel Monitor is an observability helper / toolkit for Laravel applications. .
10
+
Laravel Monitor is an observability helper / toolkit for Laravel applications.
11
+
12
+
> This package is active development and its API can change abruptly without any notice. Please reach out if you plan to use it in a production environment.
11
13
12
14
## Table of Contents
13
15
@@ -18,7 +20,10 @@ Laravel Monitor is an observability helper / toolkit for Laravel applications. .
18
20
-[Distributed Tracing](#distributed-tracing)
19
21
-[HTTP Middleware](#http-middleware)
20
22
-[Performance Timing](#performance-timing)
23
+
-[Circuit Breaker Direct Access](#circuit-breaker-direct-access)
24
+
-[Log Redactor Direct Access](#log-redactor-direct-access)
21
25
-[Log Redaction](#log-redaction)
26
+
-[Complete API Reference](#complete-api-reference)
22
27
-[Configuration](#configuration)
23
28
-[Output Examples](#output-examples)
24
29
-[Testing](#testing)
@@ -53,7 +58,7 @@ class UserController extends Controller
53
58
public function login(LoginRequest $request)
54
59
{
55
60
// Automatic origin resolution from full namespace
**Note:** While you can override with `Monitor::from('CustomName')`, using `from($this)` is preferred as it automatically provides meaningful, consistent origin tracking from your actual class structure.
82
+
**Note:** While you can override with `Monitor::log('CustomName')`, using `log($this)` is preferred as it automatically provides meaningful, consistent origin tracking from your actual class structure.
78
83
79
84
**What it logs:**
80
85
```json
81
86
{
82
87
"level": "info",
83
-
"event": "Api:UserController:info",
84
-
"message": "[Api:UserController] User login attempt",
**Note:** The `event` field uses the raw origin name (after path replacers but before wrapper), while the `message` field uses the wrapped origin name for readability.
102
+
96
103
**Configuration:** Origin path replacers, separators, and wrappers control how class names appear in logs:
**What it does:** Monitors critical operations with automatic start/end logging, exception-specific handling, DB transactions, circuit breakers, and true escalation for uncaught exceptions.
112
120
113
-
**Note:** The second parameter `$origin` (usually `$this`) is optional and automatically provides origin context to the structured logger used by the controlled block, eliminating the need for a separate `->from()` call.
121
+
**Note:** The second parameter `$origin` (usually `$this`) is optional and automatically provides origin context to the structured logger used by the controlled block, eliminating the need for a separate `->log()` call.
Monitor::log($this)->info('Processing user data', $safeData);
492
+
493
+
return $this->process($userData); // Use original for processing
494
+
}
495
+
}
496
+
```
497
+
415
498
### Log Redaction
416
499
417
500
**What it does:** Automatically scrubs sensitive data from log context using [Kirschbaum Redactor](https://github.com/kirschbaum-development/redactor) to ensure compliance and security while preserving important data.
@@ -428,7 +511,7 @@ class DataProcessor
428
511
**Usage:** Redaction is automatically applied to all Monitor log context:
429
512
430
513
```php
431
-
Monitor::from($this)->info('User data', [
514
+
Monitor::log($this)->info('User data', [
432
515
'id' => 123,
433
516
'email' => '[email protected]', // → '[REDACTED]' based on profile rules
434
517
'password' => 'secret123', // → '[REDACTED]' based on profile rules
For detailed redaction configuration, rules, patterns, and profiles, see the [Kirschbaum Redactor documentation](https://github.com/kirschbaum-development/redactor).
441
524
525
+
## Complete API Reference
526
+
527
+
The Monitor facade provides access to all monitoring components:
0 commit comments