Skip to content

Commit

Permalink
Avoid using the root logger (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
hackdna authored Dec 3, 2023
1 parent 5cf03af commit e8fa411
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 19 deletions.
7 changes: 0 additions & 7 deletions docs/source/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ import logging
logger = logging.getLogger(__name__)
```

Or like this:

```
from logging import getLogger
logger = getLogger(__name__)
```

## 3. How to insert log messages into definitions

Basic `logging` messages:
Expand Down
4 changes: 2 additions & 2 deletions forest/bonsai/simulate_gps_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
TRAVELLING_STATUS_LIST = range(11)


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


class PossibleExits(Enum):
Expand Down
4 changes: 2 additions & 2 deletions forest/jasmine/data2mobmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
TOLERANCE = 1e-6


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


def cartesian(
Expand Down
4 changes: 2 additions & 2 deletions forest/jasmine/mobmat2traj.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from .data2mobmat import great_circle_dist, exist_knot


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


# the details of the functions are in paper [Liu and Onnela (2020)]
Expand Down
4 changes: 2 additions & 2 deletions forest/jasmine/sogp_gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import numpy as np


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


def calculate_k0(x1: np.ndarray, x2: np.ndarray, pars: list) -> float:
Expand Down
4 changes: 2 additions & 2 deletions forest/jasmine/traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
from forest.utils import get_ids


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions forest/willow/log_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
)


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


def text_analysis(
Expand Down

0 comments on commit e8fa411

Please sign in to comment.