Skip to content

Commit

Permalink
use_custom_logging option
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpagnon committed Dec 10, 2024
1 parent 71b2809 commit 5e44658
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Sports2D/Demo/Config_demo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@ person_orientation = ['front', 'none', 'left'] # Choose among 'auto', 'none', 'f
# Example with one person on one video: ['front']
# Or ['front', 'none', 'left'] with 3 persons on one video
osim_setup_path = '../OpenSim_setup' # Path to the OpenSim setup folder
close_to_zero_speed_m = 0.2 # Sum for all keypoints: about 50 px/frame or 0.2 m/frame
close_to_zero_speed_m = 0.2 # Sum for all keypoints: about 50 px/frame or 0.2 m/frame

[logging]
use_custom_logging = false # if integrated in an API that already has logging
8 changes: 5 additions & 3 deletions Sports2D/Sports2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,13 @@ def process(config='Config_demo.toml'):
else:
config_dict = read_config_file(config)
video_dir, video_files, frame_rates, time_ranges, result_dir = base_params(config_dict)
use_custom_logging = config_dict.get('logging').get('use_custom_logging')

result_dir.mkdir(parents=True, exist_ok=True)
with open(result_dir / 'logs.txt', 'a+') as log_f: pass
logging.basicConfig(format='%(message)s', level=logging.INFO, force=True,
handlers = [logging.handlers.TimedRotatingFileHandler(result_dir / 'logs.txt', when='D', interval=7), logging.StreamHandler()])
if not use_custom_logging:
with open(result_dir / 'logs.txt', 'a+') as log_f: pass
logging.basicConfig(format='%(message)s', level=logging.INFO, force=True,
handlers = [logging.handlers.TimedRotatingFileHandler(result_dir / 'logs.txt', when='D', interval=7), logging.StreamHandler()])

for video_file, time_range, frame_rate in zip(video_files, time_ranges, frame_rates):
currentDateAndTime = datetime.now()
Expand Down

0 comments on commit 5e44658

Please sign in to comment.