Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance log messages #23

Merged
merged 13 commits into from
Jun 6, 2023
Merged

Enhance log messages #23

merged 13 commits into from
Jun 6, 2023

Conversation

b-hayes
Copy link
Contributor

@b-hayes b-hayes commented May 12, 2023

This PR allows the devs to inject the values into the SQL query logs as debugging queries without the values can be painful.

It is disabled by default to prevent anyone from accidentally exposing any information.

Additionally, I noticed my new Unit test was not actually being run so I deleted the PHPUnit config and just simply told it to run on the tests folder.

it appears there were a lot of tests being ignored by the original config.

With config, we get 785 assertions:
CleanShot 2023-05-18 at 18 05 15@2x

Without config 821 assertions:
CleanShot 2023-05-18 at 18 05 58@2x

and I only added 6 assertions myself.

@b-hayes b-hayes requested a review from joshmcrae May 12, 2023 06:29
@b-hayes
Copy link
Contributor Author

b-hayes commented May 12, 2023

Needs testing before I mark it as ready but feel free to comment on the approach @joshmcrae

Copy link
Member

@joshmcrae joshmcrae left a comment

Choose a reason for hiding this comment

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

@b-hayes

$i should be incremented after it is used to index $values (unless indexes start at 1). Otherwise the first replacement will use the second parameter and so on.

The value replaced into the SQL should also be quoted so that it remains valid SQL.

Copy link
Contributor Author

b-hayes commented May 17, 2023

@joshmcrae ah yup silly me. Changed $i to start at -1

@b-hayes b-hayes marked this pull request as ready for review May 18, 2023 04:59
@b-hayes b-hayes marked this pull request as draft May 18, 2023 06:01
@b-hayes b-hayes marked this pull request as ready for review May 18, 2023 08:12
@b-hayes b-hayes requested a review from joshmcrae May 18, 2023 08:13
@b-hayes
Copy link
Contributor Author

b-hayes commented May 18, 2023

@joshmcrae gave this more attention as it didn't quite operate as I thought.
There are 3 potential param arrays that may be using named placeholders so I updated and added a unit test for this new logic.
Also had to remove the restrictive phpunit config see updated description.

@joshmcrae joshmcrae merged commit cc7dedb into master Jun 6, 2023
9 checks passed
@joshmcrae joshmcrae deleted the enhance-log-messges branch June 6, 2023 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants