msupply-foundation / open-msupply

Open mSupply represents our most recent advancement in the Logistics Management Information System (LMIS), expanding on more than two decades of development inherited from the well-established legacy of the original mSupply.
https://msupply.foundation/open-msupply/
Other
23 stars 14 forks source link

Database statement logs #346

Open andreievg opened 2 years ago

andreievg commented 2 years ago

Quite often when tests fail I've used:

        // // Debug diesel query
        // println!(
        //     "{}",
        //     diesel::debug_query::<crate::DBType, _>(&final_query).to_string()
        // );

And just comment it out when needed, it would be nice to have something more generic like what's been suggested by @mark-prins here: https://github.com/openmsupply/open-msupply/pull/248#discussion_r919597479

But tests don't often initialise logger, and having this behind feature would mean rust analyzer would need to be restarted.. Not sure how to best deal with it, maybe as mark suggested but do println (and set env variable for logger level ?)

related: https://github.com/openmsupply/open-msupply/issues/344

Chris-Petty commented 9 months ago

https://github.com/msupply-foundation/open-msupply/pull/248#discussion_r919597479

image

I wonder if using env would work in tests?

andreievg commented 9 months ago

I've been commenting out these lines: https://github.com/msupply-foundation/open-msupply/blob/0a47d5388a5c45cb7029d070d57cfaf598022b81/server/service/src/sync/test/integration/central/mod.rs#L25

But should check if we can just set this in vs code rust analyser, similar to the integration test env vars: https://github.com/msupply-foundation/open-msupply/blob/0a47d5388a5c45cb7029d070d57cfaf598022b81/server/service/src/sync/test/integration/README.md#L26