File tree 2 files changed +38
-6
lines changed
2 files changed +38
-6
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,44 @@ return [
32
32
33
33
``` php
34
34
$log = LogWeaver::description('User logged in')
35
- ->content(['user_id' => 1, 'email' => '
[email protected] '])
36
- ->level('info')
37
- ->toArray();
35
+ ->logResource('event')
36
+ ->content(['user_id' => 1, 'email' => '
[email protected] '])
37
+ ->level('info')
38
+ ->toArray();
39
+ ```
40
+
41
+ ``` php
42
+ $log = LogWeaver::description('System error occurred')
43
+ ->logResource('system')
44
+ ->content(['error' => 'Database connection failed'])
45
+ ->level('error')
46
+ ->log($path, $wait);
47
+ ```
48
+
49
+ ``` php
50
+ $log = LogWeaver::description('Payment gateway down')
51
+ ->logResource('event')
52
+ ->content(['gateway' => 'Stripe', 'status' => 'down'])
53
+ ->level('critical')
54
+ ->log();
55
+ ```
56
+
57
+ ``` php
58
+ $log = LogWeaver::description('Disk space running low')
59
+ ->logResource('system')
60
+ ->content(['disk_space' => '10% remaining'])
61
+ ->level('warning')
62
+ ->toJson();
63
+ ```
64
+
65
+ ``` php
66
+ $log = LogWeaver::description('User registered')
67
+ ->logResource('event')
68
+ ->content(['user_id' => 2, 'email' => '
[email protected] '])
69
+ ->level('info')
70
+ ->disk('local')
71
+ ->directory('custom_logs')
72
+ ->log();
38
73
```
39
74
40
75
## Testing
Original file line number Diff line number Diff line change 9
9
use Illuminate \Support \Facades \Validator ;
10
10
use Illuminate \Support \Sleep ;
11
11
use Illuminate \Support \Str ;
12
- use Illuminate \Support \Traits \Dumpable ;
13
12
14
13
class LogWeaver implements Arrayable, Jsonable
15
14
{
16
- use Dumpable;
17
-
18
15
private string $ description = '' ;
19
16
20
17
private string $ logResource = 'system ' ;
You can’t perform that action at this time.
0 commit comments