Skip to content

Commit a7090fc

Browse files
committed
Logging improvements, fix default not log generating
1 parent 7c3fd3c commit a7090fc

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

pyinstalive/download.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def update_stream_data(self, from_thread=False):
280280
stream_status = stream_heartbeat.get("broadcast_status")
281281
if stream_heartbeat.get("status") == "fail":
282282
logger.separator()
283-
logger.error('The livestream host has lost connection with Instagram.')
283+
logger.error('The livestream host has possibly lost connection with Instagram.')
284284
self.download_stop = True
285285
self.downloader_object.stop()
286286
return False

pyinstalive/helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def new_config():
5252
config_file = open(globals.config.config_path, "w")
5353
config_file.write(Constants.CONFIG_TEMPLATE.format(os.getcwd()).strip())
5454
config_file.close()
55-
logger.info("A new configuration file has been created.")
55+
logger.info("A new configuration file has successfully been created.")
5656
logger.separator()
5757
return
5858
except Exception as e:
@@ -66,7 +66,7 @@ def new_config():
6666
logger.separator()
6767
except Exception as e:
6868
logger.error("An error occurred: {}".format(str(e)))
69-
logger.warn("If configuration file exists, manually create one using the following template:")
69+
logger.warn("If no configuration file exists, manually create one using the following template:")
7070
logger.whiteline()
7171
logger.plain(Constants.CONFIG_TEMPLATE)
7272
logger.whiteline()

pyinstalive/startup.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import configparser
33
import os
44
import logging
5-
5+
import sys
66

77
from . import globals
88
from . import logger
@@ -27,8 +27,9 @@ def validate_settings():
2727
logger.warn("Falling back to default path: {:s}".format(globals.config.config_path), pre_config=True)
2828
logger.separator(pre_config=True)
2929
elif not os.path.isfile(globals.config.config_path):
30+
logger.banner(log_only=True)
3031
helpers.new_config()
31-
validate_succeeded = False
32+
sys.exit(0)
3233

3334
if validate_succeeded:
3435
globals.config.config_path = os.path.realpath(globals.config.config_path)
@@ -131,21 +132,20 @@ def __init__(self, prog):
131132
parser.add_argument('-na', '--no-assemble', dest='no_assemble', action='store_true', help="Do not assemble the downloaded livestream segments into a video file. Overrides the configuration file setting.")
132133

133134
globals.args, unknown_args = parser.parse_known_args()
135+
validate_success = validate_settings()
134136

135137
if unknown_args:
136138
logger.warn("The following unknown argument(s) were provided and will be ignored.", pre_config=True)
137-
logger.warn(' ' + ' '.join(unknown_args), pre_config=True)
139+
logger.warn(' ' + ' '.join(unknown_args))
138140
logger.separator(pre_config=True)
139141

140142
if not any(vars(globals.args).values()):
141143
logger.error("No known arguments were provided.", pre_config=True)
142144
logger.separator(pre_config=True)
143-
return
145+
validate_success = False
144146

145-
validate_success = validate_settings()
146147
if globals.config.log_to_file:
147148
logger._log_to_file(None, pre_config=True)
148-
149149

150150
if validate_success:
151151
if globals.args.download or globals.args.download_following:
@@ -175,3 +175,4 @@ def __init__(self, prog):
175175
elif globals.args.info:
176176
helpers.show_info()
177177
logger.separator()
178+

0 commit comments

Comments
 (0)