From 17f688489caba4d453a3803e56e1ea4691be5c4f Mon Sep 17 00:00:00 2001 From: Benjamin Scholtz Date: Fri, 2 Sep 2022 10:45:48 +0200 Subject: [PATCH] Add logging instance (#55) --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- radcad/__init__.py | 2 +- radcad/core.py | 7 +++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 627b384..2908dda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.1] - 2022-09-02 +### Changed +- Updated to use "radCAD" logging instance + ## [0.10.0] - 2022-09-01 ### Added - Add a `deepcopy_method` Engine argument to allow setting a custom deepcopy method e.g. `copy.deepcopy` instead of default Pickle methods diff --git a/pyproject.toml b/pyproject.toml index f934553..85f3dde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "radcad" -version = "0.10.0" +version = "0.10.1" description = "A Python package for dynamical systems modelling & simulation, inspired by and compatible with cadCAD" authors = ["CADLabs "] packages = [ diff --git a/radcad/__init__.py b/radcad/__init__.py index 9a445d7..ee39715 100644 --- a/radcad/__init__.py +++ b/radcad/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.10.0" +__version__ = "0.10.1" from radcad.wrappers import Context, Model, Simulation, Experiment from radcad.engine import Engine diff --git a/radcad/core.py b/radcad/core.py index 60806d3..3688b49 100644 --- a/radcad/core.py +++ b/radcad/core.py @@ -5,6 +5,9 @@ from typing import Dict, List, Tuple, Callable +# Use "radCAD" logging instance to avoid conflict with other projects +logger = logging.getLogger("radCAD") + # Define the default method used for deepcopy operations # Must be a function and not a lambda function to ensure multiprocessing can Pickle the object def default_deepcopy_method(obj): @@ -43,7 +46,7 @@ def _single_run( deepcopy_method: Callable, drop_substeps: bool, ): - logging.info(f"Starting simulation {simulation} / run {run} / subset {subset}") + logger.info(f"Starting simulation {simulation} / run {run} / subset {subset}") initial_state["simulation"] = simulation initial_state["subset"] = subset @@ -128,7 +131,7 @@ def single_run( except Exception as error: trace = traceback.format_exc() print(trace) - logging.warning( + logger.warning( f"Simulation {simulation} / run {run} / subset {subset} failed! Returning partial results if Engine.raise_exceptions == False." ) return (result, error, trace)