-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Appends .csv to the log file string #30
base: master
Are you sure you want to change the base?
Conversation
- Updates help text This will ensure that log files are read in the proper format.
Probably better to place it here if we want to use the logfile definition elsewhere without the filename appended.
@@ -240,7 +241,7 @@ def __init__(self, url_prefix, inputs, | |||
self.use_mapfile = True | |||
self.mapfile = mapfile | |||
|
|||
self.logfile = logfile | |||
self.logfile = str(logfile + '.csv') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.logfile = str(logfile + '.csv') | |
self.logfile = logfile |
I think we actually want to put this below in the if self.logfile:
block. Otherwise could end up with a None.csv
logfile when we don't want/expect one.
@@ -240,7 +241,7 @@ def __init__(self, url_prefix, inputs, | |||
self.use_mapfile = True | |||
self.mapfile = mapfile | |||
|
|||
self.logfile = logfile | |||
self.logfile = str(logfile + '.csv') | |||
self.use_logfile = False | |||
if self.logfile: | |||
self.use_logfile = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.use_logfile = True | |
self.use_logfile = True | |
self.logfile = f'{self.logfile}.csv' |
Could also be self.logfile = '{}.csv'.format(self.logfile)
if we're trying to support Python < 3.6, but I don't think we have to worry about that at this point.
Other thing to consider: Should we just expect the full filename with the extension to the Something to think about. Sometimes a little less "magic" ends up being more flexible for a wide variety of use cases (and a little less logic to handle). |
My sense is that auto-appending file extensions to provided names only makes sense if the same base name is used for several output files. For instance, if a crawler would ask for a "collection name" and then produce a filename.warc.gz, filename.cdxj, and filename.log or similar. |
This will ensure that log files are read in the proper format and that I stop opening it in my text editor! ;)
Changes
.csv
to the user input string passed through the--log
argument.