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

[Suggestion][improvement] SQL->Log() to add to array instead of PHP_EOL #248

Open
WilliamStam opened this issue Apr 4, 2018 · 0 comments
Labels

Comments

@WilliamStam
Copy link

In my project i use the log feature to log the SQL calls to check for slow downs etc. if i do something like

$this->f3->get("DB")->exec("
    SELECT *
    FROM table
    WHERE 1
"); 

(using tabs) it fills the ->log() with lots of new lines and tab characters

(0.9ms) \r\n\t\t\tSELECT  DISTINCT tickets.* \r\n\t\t\t\t\r\n\t\t\tFROM tickets \r\n\t\t\t\t\r\n\t\t\tHAVING 1   AND (ID = :'1')  \r\n\t\t\t \r\n\t\t\t\r\n\t\t\t;\r\n\t\t\r\n (0.7ms) SELECT * from tickets\r\n

(json_encode the output)

normally this isn't an issue a simple find and replace to clean it up and we're golden. except that if i replace the characters i end up replacing the PHP_EOL between different sql commands

suggestion would be to keep the log in an array rather and maybe to have an output to pure text (in case of cli) or return the array.

as it is now its not that useful for real world "monitoring" of performance etc

@ikkez ikkez added the v4 label Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants