Skip to content

Commit 9260f88

Browse files
committed
log
1 parent e313de0 commit 9260f88

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/FFMpeg/FFMpeg.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,29 @@ class FFMpeg
1313

1414
public string $ffprobe;
1515

16+
public ?string $logChannel = null;
17+
1618
final public function __construct(
1719
?string $ffmpeg = null,
1820
?string $ffprobe = null,
21+
?string $logChannel = null,
1922
) {
2023
// @phpstan-ignore-next-line
2124
$this->ffmpeg = $ffmpeg ?? config('media.ffmpeg.ffmpeg_binaries') ?? config('laravel-ffmpeg.ffmpeg.binaries');
25+
2226
// @phpstan-ignore-next-line
2327
$this->ffprobe = $ffprobe ?? config('media.ffprobe.ffprobe_binaries') ?? config('laravel-ffmpeg.ffprobe.binaries');
28+
29+
// @phpstan-ignore-next-line
30+
$this->logChannel = $logChannel ?? config('media.ffmpeg.log_channel');
2431
}
2532

2633
public static function make(
2734
?string $ffmpeg = null,
2835
?string $ffprobe = null,
36+
?string $logChannel = null,
2937
): static {
30-
return new static($ffmpeg, $ffprobe);
38+
return new static($ffmpeg, $ffprobe, $logChannel);
3139
}
3240

3341
public function video(): Video
@@ -40,9 +48,8 @@ public function video(): Video
4048
*/
4149
protected function execute(string $command): array
4250
{
43-
// @phpstan-ignore-next-line
44-
if ($channel = config('media.ffmpeg.log_channel')) {
45-
Log::channel($channel)->info("ffmpeg: {$command}");
51+
if ($this->logChannel) {
52+
Log::channel($this->logChannel)->info("ffmpeg: {$command}");
4653
}
4754

4855
exec($command, $output, $code);

0 commit comments

Comments
 (0)