Skip to content
Snippets Groups Projects
Unverified Commit efe479ce authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

add a bit more logging

parent e40fe7d7
No related branches found
No related tags found
No related merge requests found
......@@ -32,3 +32,7 @@ def info(msg: str):
def warning(msg: str):
print(f"[bold yellow]WARNING[/bold yellow]: {msg}")
def debug(msg: str):
print(f"[bold green]DEBUG[/bold green]: {msg}")
......@@ -8,7 +8,7 @@ import shutil
from itertools import zip_longest
from error import GPLTError
from log import panic, warning
from log import panic, warning, debug, info
from typing import Any, Dict, List, Optional, Tuple, TypedDict
......@@ -196,6 +196,7 @@ def _plot_single(g: Graph, i: int, ax: matplotlib.axes.Axes) -> matplotlib.lines
line = ax.plot(xs, ys, label=g.get("name", None), **line_style)[0]
if len(es) != 0:
debug(f"adding errors to graph {name}")
ys, es = np.array(ys), np.array(es)
down = ys - es
up = ys + es
......@@ -228,6 +229,8 @@ def _check_class_fields(
def check(graphs: Any):
info(f"checking graphs")
if not isinstance(graphs, list):
panic(
GPLTError.INVALID_ARGUMENTS,
......@@ -238,6 +241,7 @@ def check(graphs: Any):
required_point_fields = __get_class_fields(Point)
for i, g in enumerate(graphs):
debug(f"checking graph {i}")
if not isinstance(g, dict):
panic(
GPLTError.INVALID_ARGUMENTS,
......@@ -254,7 +258,7 @@ def check(graphs: Any):
)
# TODO: check style
warning(f"the style of graph {name} won't be checked")
info(f"the style of graph {name} won't be checked")
# see [`HELP`]
......@@ -299,9 +303,12 @@ def plot(
legends = {}
for i, g in enumerate(graphs):
info(f"plotting graph {i}")
line = _plot_single(g, i, ax)
legend = g.get("legend", None)
if legend is not None:
debug(f"adding legend of graph {i}")
if legend not in legends:
legends[legend] = []
legends[legend] += [line]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment