alexeyr / erlang-sqlite3

Sqlite gen_server port for Erlang. Creates, reads and writes to sqlite database.
Other
90 stars 33 forks source link

error logging #10

Closed booo closed 12 years ago

booo commented 12 years ago

I'm currently working with your library and I'm having some problems with the way you log/report errors. The actual line that annoys me a bit is https://github.com/alexeyr/erlang-sqlite3/blob/master/src/sqlite3.erl#L1038

I do not want the library to log errors for me. The library should return error tuples and I can handle the logging in my application code if I want to. Do you think we can change code? I can add a pull request to this ticket if you like. If there is another way to disable the logging please let me know!

Thanks for maintaining the library! Seems to be nice really nice so far.

Best Regards Philipp

alexeyr commented 12 years ago

Yes, I think it's reasonable. Probably need to do the same with C code when DEBUG isn't defined. OTOH, https://github.com/alexeyr/erlang-sqlite3/blob/master/src/sqlite3.erl#L976 probably needs to stay since you can't normally get results from terminate.

booo commented 12 years ago

Would be really great if you could change the code. I'm not sure about the gen_server:terminate but I think this is rare error and logging is ok in this situation. Maybe the best solution for erlang and c code is to have a DEBUG flag?

alexeyr commented 12 years ago

While DEBUG as a macro makes sense for C code, I don't like it for Erlang. It could be an option passed to open, I guess... Probably no need, better just to remove it everywhere except when loading/unloading the driver. Could you add the pull request?

Yours, Alexey Romanov

On Wed, Jun 13, 2012 at 10:33 PM, Ⓐ reply@reply.github.com wrote:

Would be really great if you could change the code. I'm not sure about the gen_server:terminate but I think this is rare error and logging is ok in this situation. Maybe the best solution for erlang and c code is to have a DEBUG flag?


Reply to this email directly or view it on GitHub: https://github.com/alexeyr/erlang-sqlite3/issues/10#issuecomment-6309415

alexeyr commented 12 years ago

Done. Also changed C code to log only when DEBUG is defined.

booo commented 12 years ago

Thanks a lot!