Skip to content

Commit

Permalink
fix: use logger warning instead of system warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hfudev committed Sep 6, 2024
1 parent f4d4347 commit 72c48b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions idf_build_apps/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
import re
import typing as t
import warnings
from copy import deepcopy
from dataclasses import InitVar, asdict, dataclass, field, fields

Expand Down Expand Up @@ -141,8 +140,10 @@ def __setattr__(self, key, value):
# set together with the deprecated field
super().__setattr__(_new_name_deprecated_name_dict[key], value)
elif key in _deprecated_name_new_name_dict:
warnings.warn(
f'Field {key} is deprecated by {_deprecated_name_new_name_dict[key]}. Will be removed in the future.'
LOGGER.warning(
'Field %s is deprecated by %s. Will be removed in the future.',
key,
_deprecated_name_new_name_dict[key],
)
super().__setattr__(key, value)
# set together with the new field
Expand Down
5 changes: 2 additions & 3 deletions idf_build_apps/manifest/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os
import pickle
import typing as t
import warnings
from hashlib import sha512

from pyparsing import (
Expand Down Expand Up @@ -257,7 +256,7 @@ def from_files(cls, paths: t.Iterable[str], *, root_path: str = os.curdir) -> 'M
if cls.CHECK_MANIFEST_RULES:
raise InvalidManifest(msg)
else:
warnings.warn(msg)
LOGGER.warning(msg)

_known_folders[rule.folder] = path

Expand Down Expand Up @@ -290,7 +289,7 @@ def from_file(cls, path: str, *, root_path: str = os.curdir) -> 'Manifest':
if cls.CHECK_MANIFEST_RULES:
raise InvalidManifest(msg)
else:
warnings.warn(msg)
LOGGER.warning(msg)

try:
rules.append(FolderRule(folder, **folder_rule if folder_rule else {}))
Expand Down

0 comments on commit 72c48b7

Please sign in to comment.