Skip to content

Commit

Permalink
Feature/hide not found (#44)
Browse files Browse the repository at this point in the history
* Hide "No files for wildcard" warnings to debug

* rework logging to store all wb-diag-collect logs
  • Loading branch information
vdromanov authored Aug 7, 2024
1 parent 888e7a5 commit ecba9d2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-diag-collect (1.8.12) stable; urgency=medium

* Hide "No files for wildcard" warnings to debug

-- Vladimir Romanov <v.romanov@wirenboard.com> Tue, 06 Aug 2024 16:58:21 +0300

wb-diag-collect (1.8.11) stable; urgency=medium

* Hide PIN from *.nmconnection files
Expand Down
4 changes: 2 additions & 2 deletions wb/diag/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def collect(self, options, output_directory, output_filename):
try:
self.log_stream = StringIO()
self.log_stream_handler = logging.StreamHandler(self.log_stream)
self.log_stream_handler.setLevel(logging.DEBUG)
self.log_stream_handler.setFormatter(
logging.Formatter("%(asctime)s [%(levelname)s] %(message)s")
)
self.logger.setLevel(self.logger.getEffectiveLevel())
self.logger.addHandler(self.log_stream_handler)

self.copy_files(tmpdir, options["files"])
Expand Down Expand Up @@ -70,7 +70,7 @@ def apply_file_wildcard(self, wildcard: str, timeout):

try:
if proc.wait(timeout) != 0:
self.logger.warning("No files for wildcard %s", wildcard)
self.logger.debug("No files for wildcard %s", wildcard)
return []

file_paths = []
Expand Down
15 changes: 7 additions & 8 deletions wb/diag/diag_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ class ResultCode(IntEnum):


logger = logging.getLogger(__name__)

console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
logger.addHandler(console_handler)

logger.setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)


def main(argv=sys.argv):
Expand All @@ -44,8 +38,13 @@ def main(argv=sys.argv):
args = parser.parse_args(argv[1:])
conf_path = args.config

console_handler = logging.StreamHandler()
console_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
console_loglevel = logging.INFO
if args.debug:
logger.setLevel(logging.DEBUG)
console_loglevel = logging.DEBUG
console_handler.setLevel(console_loglevel)
logger.addHandler(console_handler)

try:
with open(conf_path or DEFAULT_CONF_PATH) as f:
Expand Down

0 comments on commit ecba9d2

Please sign in to comment.