Skip to content

Commit

Permalink
fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
folkien committed Feb 22, 2025
1 parent 1b2b622 commit f36c4eb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ yaya-benchmark = "yaya_tools.yaya_benchmark:main"
yaya-inference = "yaya_tools.yaya_inference:main"
yaya-augument = "yaya_tools.yaya_augument:main"
yaya-inference-qt5 = "yaya_tools.yaya_inference_qt5:main"
yaya-darknet-logs-qt5 = "yaya_tools.yaya_darknet_logs_qt5:main"
30 changes: 29 additions & 1 deletion yaya_tools/yaya_logs.py → yaya_tools/yaya_darknet_logs_qt5.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import argparse
import logging
import os
import re
import sys
Expand All @@ -18,6 +19,28 @@
figure_width = 6 # Width of each figure in the layout


def logging_terminal_setup() -> None:
"""
Setup logging for the application.
Parameters
----------
path_field : str
Field in the config file that contains the path to the log file.
Default is "path".
is_terminal : bool
If True, logs will be printed to the terminal.
Default is True.
"""
logging.getLogger().setLevel(logging.DEBUG) # Ensure log level is set to DEBUG
formatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s")
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
console.setFormatter(formatter)
logging.getLogger().addHandler(console)
logging.info("\n\n###### Logging start of terminal session ######\n")


# --------------------------
# Log Parsing Functions
# --------------------------
Expand Down Expand Up @@ -260,7 +283,12 @@ def update_figures(self):
# --------------------------
# Main Routine with Argparse
# --------------------------
def main():
def main() -> None:
"""
Main function for comparing two Darknet logs and showing previews in a Qt5 window.
"""
logging_terminal_setup()
# Argument parser
parser = argparse.ArgumentParser(description="Compare two Darknet logs and show previews in a Qt5 window.")
parser.add_argument("--log1", type=str, default="", help="Path to log 1 file")
parser.add_argument("--log2", type=str, default="", help="Path to log 2 file")
Expand Down

0 comments on commit f36c4eb

Please sign in to comment.