-
Notifications
You must be signed in to change notification settings - Fork 18
Implement Custom Log File #2 #17
Implement Custom Log File #2 #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
src/DeleteOldSoftDeletes.php
Outdated
@@ -9,6 +9,7 @@ | |||
use Illuminate\Database\Eloquent\SoftDeletes; | |||
use Illuminate\Support\Collection; | |||
use Illuminate\Support\Facades\Log; | |||
use Monolog\Logger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can drop this import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will drop this.
src/DeleteOldSoftDeletes.php
Outdated
@@ -75,6 +76,10 @@ private function logAffectedRows(Collection $deletedRows) | |||
if (! $this->config->get('quicksand.log', false) || empty($preparedRows)) { | |||
return; | |||
} | |||
|
|||
if (! $this->config->get('quicksand.custom_log_file', false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean this to be !!
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh Damn... yeahr sorry!
@@ -7,6 +7,10 @@ | |||
// Whether to log the number of soft deleted records per model | |||
'log' => false, | |||
|
|||
// If you log the soft deleted records per model, this is the path where it will be stored | |||
// false if you want the default laravel log file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a third line of comment showing an example path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@LKDevelopment This looks great! One problem: This adds the logs to a custom log file, but it doesn't keep those logs from being written to the default laravel.log file. Is that something you think you could tackle as a part of it? Thanks! |
@mattstauffer Should be fixed now. I get all Handlers from the Monolog instance, clear the handlers array, set a new Handler with Log::useFiles and reset all after the log is written :) |
@LKDevelopment Great! Nice work! |
Hello,
Happy #Hacktoberfest so let's start with some issues :)
This little PR implements the possibility to use custom log files. You can add a path to a custom file and than it will log to the file there :)