Utilities#
- pyrake.enable_logging(path=None, level=20, solver_level=30, mode='w')[source]#
Log PyRake’s calibration narration, and Cvxium’s solves beneath it.
Wires
pyrakeand its dependencycvxiumto one shared handler, so the inner solver’s output lands underneath the line naming the stage that invoked it rather than in a separate file with separate timestamps.The two namespaces get separate thresholds because they are wanted at different volumes. The default is the narration alone – one line per calibration, one per fallback stage, each with a timing – which is a couple of dozen lines and answers “which stage, and where did the time go”. Cvxium’s own INFO is per-centering-step and runs to thousands of lines on a real problem, so it is off until asked for, and its DEBUG is per-Newton-iteration.
- Parameters:
path (str or PathLike, optional) – Log file.
~is expanded. None logs to stderr.level (int, optional) – Threshold for
pyrake: the calibration narration.solver_level (int, optional) – Threshold for
cvxium: the solves underneath. Defaults tologging.WARNING, i.e. silent unless something goes wrong.mode (str, optional) – File mode;
"w"truncates per run.
- Returns:
The attached handler.
- Return type:
Examples
Narration only:
pyrake.enable_logging("~/calibration.log")
A slow stage, and you want to see the solver work through it:
pyrake.enable_logging("~/calibration.log", solver_level=logging.INFO)