Skip to content

Commit 30c8953

Browse files
committed
bump
1 parent e7faa02 commit 30c8953

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

proj/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import pyinspect
2+
3+
pyinspect.install_traceback()
4+
15
# Set up logging
2-
from proj.utils.logging import log
6+
from proj.utils.logging import log, rich_to_txt
37

48
# import stuff
59
from proj.model.config import Config

proj/environment/trajectories.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from scipy.optimize import curve_fit
44
from sklearn.metrics import mean_squared_error
55
from rich.table import Table
6-
from rich import print
76
import logging
87

98
from fcutils.maths.geometry import (
@@ -15,6 +14,7 @@
1514
from fcutils.maths.filtering import line_smoother
1615

1716
from proj.utils.misc import interpolate_nans
17+
from proj import log, rich_to_txt
1818

1919

2020
def complete_given_xy(x, y, params, planning_params):
@@ -82,23 +82,7 @@ def compute_trajectory_stats(
8282
)
8383

8484
# log stuff
85-
log = logging.getLogger("rich")
86-
log.setLevel(logging.INFO)
87-
88-
log.info(
89-
f"""
90-
n_points = {n_points}
91-
distance_travelled = {distance_travelled}
92-
waypoint_density = {waypoint_density}
93-
start_goal_distance = {start_goal_distance}
94-
duration = {duration}
95-
lookahead = {lookahead}
96-
perc_lookahead = {perc_lookahead}
97-
"""
98-
)
99-
100-
# print stuff
101-
print(table)
85+
logging.info(rich_to_txt(table), extra={"markup": True})
10286

10387
if waypoint_density < 2 or waypoint_density > 3:
10488
log.info(

proj/utils/logging.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
from rich.logging import RichHandler
3+
from rich.console import Console
34

45
# supress warnings
56
import pandas as pd
@@ -16,6 +17,12 @@
1617
)
1718

1819
log = logging.getLogger("rich")
20+
logging_console = Console(record=True)
21+
22+
23+
def rich_to_txt(obj):
24+
logging_console.print(obj)
25+
return logging_console.export_text()
1926

2027

2128
# Disable logging some packages

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"fancylog",
1919
"slackclient",
2020
"dropbox",
21-
"json",
21+
"pyinspect",
2222
]
2323

2424
setup(

0 commit comments

Comments
 (0)