Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Implement Custom Log File #2 #17

Merged
merged 4 commits into from
Oct 3, 2017
Merged

Implement Custom Log File #2 #17

merged 4 commits into from
Oct 3, 2017

Conversation

LKaemmerling
Copy link
Contributor

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 :)

Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@@ -9,6 +9,7 @@
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Monolog\Logger;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can drop this import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will drop this.

@@ -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)) {
Copy link
Member

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 !! ?

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@mattstauffer
Copy link
Member

@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!

@LKaemmerling
Copy link
Contributor Author

@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 :)

@mattstauffer
Copy link
Member

@LKDevelopment Great! Nice work!

@mattstauffer mattstauffer merged commit e522fe6 into tighten:master Oct 3, 2017
@LKaemmerling LKaemmerling deleted the feature/use-custom-logfiles branch October 3, 2017 16:34
@LKaemmerling LKaemmerling mentioned this pull request Oct 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants