Skip to content

Commit

Permalink
Add logging instance (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSchZA authored Sep 2, 2022
1 parent a2df877 commit 17f6884
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
packages = [
Expand Down
2 changes: 1 addition & 1 deletion radcad/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions radcad/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 17f6884

Please sign in to comment.