diff --git a/Sports2D/Demo/Config_demo.toml b/Sports2D/Demo/Config_demo.toml index baa3308..0b0054f 100644 --- a/Sports2D/Demo/Config_demo.toml +++ b/Sports2D/Demo/Config_demo.toml @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/Sports2D/Sports2D.py b/Sports2D/Sports2D.py index d1a516a..718f96c 100644 --- a/Sports2D/Sports2D.py +++ b/Sports2D/Sports2D.py @@ -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()