Skip to content

Commit cec6f97

Browse files
committed
Improved logging process for deferred or queued actions in documentation and updated default logging in 'UsingLogged' function
1 parent 5493f5c commit cec6f97

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

docs/helpers.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ execute('send welcome email', function () {
8686
})->logged(channel: 'stack');
8787
```
8888

89-
Behind the scenes, this will write a log to the requested channel to help you understand the exact moment the action was performed. The log output will be assembled as follows:
89+
Behind the scenes, this will write a log to the requested `channel` to help you understand the exact moment the action was performed. The log output will be written as follows:
9090

9191
```txt
9292
[2025-05-31 21:04:10] local.INFO: [<app.name>] Action: [<action name>] executed at 2025-05-31 21:04:10
9393
```
94+
95+
Keep in mind the log is written right after the process is dispatched, which means the log output does not represent the exact moment the action logic was executed. For situations where you are interacting with `deferred` or `queued` actions, you might see a difference between the log time and the actual execution time of the action logic, due to the way these actions are processed.

src/Concerns/UsingLogged.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ trait UsingLogged
1616
/**
1717
* Enable the action to be deferred.
1818
*
19+
* @param string|null $channel - `null` to use the default logging channel.
1920
* @return $this
2021
*/
2122
public function logged(?string $channel = null): self
2223
{
23-
$this->logged = new LoggedUsing($channel);
24+
$this->logged = new LoggedUsing($channel ?? config('logging.default'));
2425

2526
return $this;
2627
}

src/FractionBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Illuminate\Foundation\Application;
1919
use InvalidArgumentException;
2020
use Laravel\SerializableClosure\SerializableClosure;
21-
use RuntimeException;
2221
use UnitEnum;
2322

2423
final class FractionBuilder implements Arrayable

0 commit comments

Comments
 (0)