Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
zbalkan committed Sep 17, 2023
1 parent c01e290 commit bc06f52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/hunter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import os
from typing import Generator, Optional

Expand Down Expand Up @@ -38,6 +39,8 @@ def get_scannable_files(self) -> Generator[tuple, None, None]:
docs_found = 0
root_total_items: int = 0

logging.info(f"Search base: {self.__conf.search_dir}")

for root, sub_ds, files in os.walk(top=self.__conf.search_dir):
# list[str]
sub_dirs: list = [check_dir for check_dir in sub_ds if os.path.join(
Expand All @@ -64,8 +67,10 @@ def get_scannable_files(self) -> Generator[tuple, None, None]:
yield docs_found, root_total_items, root_items_completed

self.__all_files += doc_files
logging.info(f"Total number of files: {len(self.__all_files)}")

# def scan_files(self) -> Generator[tuple[int, int], None, None]:

def scan_files(self) -> Generator[tuple, None, None]:
""" Searches files in doc_files list for regular expressions"""

Expand Down
3 changes: 2 additions & 1 deletion src/panhunt.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from pbar import DocProgressbar
from report import Report

APP_NAME: str = 'PANhunt'
APP_VERSION: str = '1.4'


Expand Down Expand Up @@ -124,7 +125,7 @@ def main() -> None:
# datefmt="%Y-%m-%dT%H:%M:%S%z",
# level=logging.INFO)

logging.basicConfig(filename=os.path.join(panutils.get_root_dir(), 'PANhunt.log'),
logging.basicConfig(filename=os.path.join(panutils.get_root_dir(), f'{APP_NAME}.log'),
format='%(asctime)s:%(levelname)s:%(message)s',
datefmt="%Y-%m-%dT%H:%M:%S%z",
level=logging.INFO)
Expand Down

0 comments on commit bc06f52

Please sign in to comment.