From c2244c060d33d09405d636bac803863681a59be5 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 15 Jan 2025 08:49:20 -0800 Subject: [PATCH] feat: Log configs (#225) Log simplified versions of the config files to stderr. May be useful in services, to look at logs later to understand when configs changed, and how they may have impacted performance. --- shaka-streamer | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/shaka-streamer b/shaka-streamer index 25d2111..f989225 100755 --- a/shaka-streamer +++ b/shaka-streamer @@ -26,6 +26,7 @@ https://shaka-project.github.io/shaka-streamer/ """ import argparse +import json import sys import time import yaml @@ -84,6 +85,12 @@ See docs: https://shaka-project.github.io/shaka-streamer/cloud_storage.html help='Use FFmpeg, FFprobe and Shaka Packager binaries ' + 'found in PATH instead of the ones offered by ' + 'Shaka Streamer.') + parser.add_argument('--log-configs', + action='store_true', + help='Log simplified versions of the config files to ' + + 'stderr. May be useful in services, to look at ' + + 'logs later to understand when configs changed, ' + + 'and how they may have impacted performance.') args = parser.parse_args() @@ -100,6 +107,14 @@ See docs: https://shaka-project.github.io/shaka-streamer/cloud_storage.html with open(args.bitrate_config) as f: bitrate_config_dict = yaml.safe_load(f) + if args.log_configs: + configs = { + 'input': input_config_dict, + 'pipeline': pipeline_config_dict, + 'bitrate': bitrate_config_dict, + } + print('Configs: {}'.format(json.dumps(configs)), file=sys.stderr) + try: if args.cloud_url: print('Warning: -c/--cloud-url is deprecated; use -o/--output instead',