FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.08k stars 198 forks source link

Replace printing with logging #75

Open n8sty opened 3 years ago

n8sty commented 3 years ago

I'm using cdt (thanks for this package!) in a few different toy projects. I'm wondering whether it would tolerable to replace calls to print that are used for logging (eg: https://github.com/FenTechSolutions/CausalDiscoveryToolbox/blob/184b33d218259b511772f4e089d201c0ddeaa019/cdt/causality/graph/model.py#L69) to an actual logger. This would make it a bit easier to observe processes that use cdt through regular means. It's also possible for me to redirect stdout/err to a logger so this isn't a huge blocking problem, but I do think it would make this package just that much easier to integrate into larger projects. I'd be happy to open a PR to this effect.

diviyank commented 3 years ago

Hello @n8sty, You are right ! We need to transition from raw printing to logging. Could you open a PR on this ?

Thanks for the feedback! Diviyan

diviyank commented 3 years ago

Hi again @n8sty , Were you able to work on this matter ?

Kind regards, Diviyan

n8sty commented 3 years ago

I should have an opportunity to take a crack it soon, maybe in a week or two. Do you have any particular features you'd like for the logging setup? I was thinking of just attaching a NullHandler and replacing all of the print statements with calls to my best guess at an appropriately leveled log message. If this sounds good, I should hopefully have a PR open in a week or two since it's not too much work.