Skip to content

Commit b19217f

Browse files
jrmontagAaron Gonzales
authored andcommitted
Add additional context to --debug log messages (#28)
* Add additional context to --debug log messages In the `main()` method, in debug mode, we print out the argument dictionaries a few times but without context for which one is which. This commit adds an extra line of debug logging each time that indicates from which point in the process the args are originating. Hopefully this will expedite any arg parsing debugging. I've also removed one line of unused code that created an intermediate object for the argparse object. * Bump version
1 parent a2d2758 commit b19217f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
long_description=open('README.rst', 'r', encoding="utf-8").read(),
88
author_email='[email protected]',
99
license='MIT',
10-
version='1.4.0',
10+
version='1.5.0',
1111
python_requires='>=3.3',
1212
install_requires=["requests", "tweet_parser", "pyyaml"],
1313
packages=find_packages(),

tools/search_tweets.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,20 @@ def parse_cmd_args():
138138

139139

140140
def main():
141-
parser = parse_cmd_args()
142141
args_dict = vars(parse_cmd_args().parse_args())
143142
if args_dict.get("debug") is True:
144143
logger.setLevel(logging.DEBUG)
144+
logger.debug("command line args dict:")
145145
logger.debug(json.dumps(args_dict, indent=4))
146146

147147
if args_dict.get("config_filename") is not None:
148148
configfile_dict = read_config(args_dict["config_filename"])
149149
else:
150150
configfile_dict = {}
151151

152+
logger.debug("config file dict:")
153+
logger.debug(json.dumps(configfile_dict, indent=4))
154+
152155
creds_dict = load_credentials(filename=args_dict["credential_file"],
153156
account_type=args_dict["account_type"],
154157
yaml_key=args_dict["credential_yaml_key"],
@@ -160,6 +163,7 @@ def main():
160163
dict_filter(args_dict),
161164
dict_filter(creds_dict))
162165

166+
logger.debug("combined dict (cli, config, creds):")
163167
logger.debug(json.dumps(config_dict, indent=4))
164168

165169
if len(dict_filter(config_dict).keys() & REQUIRED_KEYS) < len(REQUIRED_KEYS):
@@ -169,8 +173,6 @@ def main():
169173

170174
stream_params = gen_params_from_config(config_dict)
171175

172-
logger.debug(json.dumps(config_dict, indent=4))
173-
174176
rs = ResultStream(tweetify=False, **stream_params)
175177

176178
logger.debug(str(rs))

0 commit comments

Comments
 (0)