@@ -409,7 +409,7 @@ so that it isn't lost when we finish our command line session.
409409for handler in logging.root.handlers[:]:
410410 logging.root.removeHandler(handler)
411411
412- logging.basicConfig(level=logging.debug , filename='log.txt'))
412+ logging.basicConfig(level=logging.DEBUG , filename='log.txt'))
413413
414414rh_data = np.array([1.5, 20.4, 100.1, 76.3, 54.4])
415415rh_max = rh_data.max()
@@ -420,7 +420,10 @@ logging.debug(f'The maximum relative humidity was {rh_max}%')
420420(The for loop is needed to turn off the background logging the notebook does itself.
421421It's not needed in a Python script.)
422422
423- By setting the logging level to "debug",
423+ Notice that we've used capital ` logging.DEBUG ` (which is an integer value) to set the logging level,
424+ as opposed to the ` logging.debug ` function that is used for logging a message.
425+
426+ By setting the logging level to "DEBUG",
424427our output "log.txt" file will now capture all logging information
425428with a flag of 'debug' or higher - that is,
426429all logging outputs will be written to our log file.
@@ -451,7 +454,7 @@ and set the logging configuration and add a `logging.info` command in the `main`
451454def main(inargs):
452455 """Run the program."""
453456
454- logging.basicConfig(level=logging.debug , filename='log.txt')
457+ logging.basicConfig(level=logging.DEBUG , filename='log.txt')
455458
456459 ...
457460
@@ -478,7 +481,7 @@ def main(inargs):
478481> def main(inargs):
479482> """Run the program."""
480483>
481- > logging.basicConfig(level=logging.debug , filename='log.txt')
484+ > logging.basicConfig(level=logging.DEBUG , filename='log.txt')
482485>
483486> dset = xr.open_dataset(inargs.pr_file)
484487>
@@ -553,7 +556,7 @@ def main(inargs):
553556> > ## Solution
554557> >
555558> > The basic configuration command at the top of the `main` function
556- > > (`logging.basicConfig(level=logging.debug , filename='log.txt')`)
559+ > > (`logging.basicConfig(level=logging.DEBUG , filename='log.txt')`)
557560> > needs to be replaced with the following:
558561> >
559562> > ~~~
0 commit comments