Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cesargb committed Apr 17, 2021
1 parent 0d97e22 commit d82987d
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,32 @@ use Cesargb\Log\Rotation;
$rotation = new Rotation();

$rotation
->compress() // Optional, compress the file after rotated
->files(30) // Optional, files are rotated 30 times before being removed
->minSize(1024) // Optional, are rotated when they grow bigger than 1024 bytes
->compress() // Optional, compress the file after rotated. Default false
->files(30) // Optional, files are rotated 30 times before being removed. Default 366
->minSize(1024) // Optional, are rotated when they grow bigger than 1024 bytes. Default 0
->then(function ($filename) {}) // Optional, to get filename rotated
->catch(function ($exception) {}) // Optional, to catch a exception in rotating
->rotate('file.log');
```

Or you can define the options in the constructor

```php
use Cesargb\Log\Rotation;

$rotation = new Rotation([
'files' => 1,
'compress' => true,
'min-size' => 10,
'then' => function ($filename) {},
'catch' => function ($error) {},
]);

$rotation->rotate('file.log');
```

## Test

Run test with:

```bash
Expand Down

0 comments on commit d82987d

Please sign in to comment.