Skip to content

Commit 5111a6f

Browse files
committed
ICL: getLogPath method extracted.
1 parent c03fb7a commit 5111a6f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Loggable.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminated\Console;
44

5+
use Illuminate\Support\Str;
56
use Illuminated\Console\Log\Formatter;
67
use Monolog\Handler\RotatingFileHandler;
78
use Monolog\Logger;
@@ -45,14 +46,16 @@ protected function initializeLogging()
4546

4647
private function getLogHandlers()
4748
{
48-
$type = $this->type();
49-
$entity = $this->argument('entity');
50-
$path = storage_path("logs/cloud/{$type}/{$entity}/date.log");
51-
52-
$rotatingFileHandler = new RotatingFileHandler($path, 30);
49+
$rotatingFileHandler = new RotatingFileHandler($this->getLogPath(), 30);
5350
$rotatingFileHandler->setFilenameFormat('{date}', 'Y-m-d');
5451
$rotatingFileHandler->setFormatter(new Formatter());
5552

5653
return [$rotatingFileHandler];
5754
}
55+
56+
protected function getLogPath()
57+
{
58+
$name = Str::replaceFirst(':', '/', $this->getName());
59+
return storage_path("logs/{$name}/date.log");
60+
}
5861
}

0 commit comments

Comments
 (0)