File tree 1 file changed +20
-3
lines changed
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,32 @@ use Cesargb\Log\Rotation;
25
25
$rotation = new Rotation();
26
26
27
27
$rotation
28
- ->compress() // Optional, compress the file after rotated
29
- ->files(30) // Optional, files are rotated 30 times before being removed
30
- ->minSize(1024) // Optional, are rotated when they grow bigger than 1024 bytes
28
+ ->compress() // Optional, compress the file after rotated. Default false
29
+ ->files(30) // Optional, files are rotated 30 times before being removed. Default 366
30
+ ->minSize(1024) // Optional, are rotated when they grow bigger than 1024 bytes. Default 0
31
31
->then(function ($filename) {}) // Optional, to get filename rotated
32
32
->catch(function ($exception) {}) // Optional, to catch a exception in rotating
33
33
->rotate('file.log');
34
34
```
35
35
36
+ Or you can define the options in the constructor
37
+
38
+ ``` php
39
+ use Cesargb\Log\Rotation;
40
+
41
+ $rotation = new Rotation([
42
+ 'files' => 1,
43
+ 'compress' => true,
44
+ 'min-size' => 10,
45
+ 'then' => function ($filename) {},
46
+ 'catch' => function ($error) {},
47
+ ]);
48
+
49
+ $rotation->rotate('file.log');
50
+ ```
51
+
36
52
## Test
53
+
37
54
Run test with:
38
55
39
56
``` bash
You can’t perform that action at this time.
0 commit comments