diff --git a/fitlog/fastlog/logger.py b/fitlog/fastlog/logger.py index cfd17e2..290afef 100644 --- a/fitlog/fastlog/logger.py +++ b/fitlog/fastlog/logger.py @@ -746,7 +746,7 @@ def _parse_value(value: Union[int, str, float, dict], name: str, parent_name: st elif isinstance(value, np.integer): value = int(value) elif isinstance(value, np.floating): - value = float(value) + value = float(value) if not(math.isnan(value) and math.isinf(value)) else str(value) else: value = str(value) # 直接专为str类型 assert name is not None, f"When value is `{type(value)}`, you must pass a name." @@ -796,7 +796,7 @@ def _check_dict_value(_dict: dict, prefix: str = ''): elif isinstance(value, (np.integer, int)): _dict[key] = int(value) elif isinstance(value, (np.floating, float)): - _dict[key] = float(value) + _dict[key] = float(value) if not (math.isnan(value) and math.isinf(value)) else str(value) else: _dict[key] = str(value)