waza-ari / monolog-mysql

MySQL Handler for Monolog, which allows to store log messages to a MySQL Table
MIT License
141 stars 85 forks source link

Allow $pdo to be nullable, to be able to extend class yourself + adjust VARCHAR into TEXT #5

Closed stefandoorn closed 9 years ago

stefandoorn commented 9 years ago

I changed $pdo into a nullable parameter. Allows me to extend your class and add my own PDO class into the object. Point is that I use a PDO connection, but it's wrapped in another object for debugging purposes (PHPDebugBar).

Besides that I adjusted the VARCHAR(200) into TEXT. In some cases more logging is required. Data storage required is length + 2 bytes, so still people can insert short data without big problems.

tgabi333 commented 9 years ago

+1 on this. I would love to see that if PDO typehint was cleared to pass a closure to solve the problem to initialize PDO when used for the first time, because now you have to open a database connection even if you dont use it at all.

waza-ari commented 9 years ago

Just a heads up: I am currently quite busy and won't be able to look into this issue before the weekend. Expect an answer on Sunday :)

waza-ari commented 9 years ago

So these are basically two related issues. I have merged the pull-request and created a new release based on code on stefandoorn.

@tgabi333: If I understand this correctly, you want to pass a closure that is evaluated on first usage returning the required pdo object? Could you please file a separate issue for this? Thanks!

Best, Daniel