oracc / nisaba

GNU General Public License v3.0
3 stars 0 forks source link

Investigate logging options #33

Closed ageorgou closed 3 years ago

ageorgou commented 3 years ago

See also #26, putting here for more focused discussion. We may need to use different logging mechanisms to show information to users and to store for later debugging.

raquelalegre commented 3 years ago

From a quick grep, this is what Nammu logs to the user in their console (all info and error messages):

./controller/NammuController.py:        self.logger.info("Welcome to Nammu!")
./controller/NammuController.py:        self.logger.info(
./controller/NammuController.py:                self.logger.info("File %s successfully opened.", filename)
./controller/NammuController.py:            self.logger.info("File %s successfully saved.",
./controller/NammuController.py:                self.logger.info("File %s successfully saved.",
./controller/NammuController.py:                self.logger.info('{0} cannot be found.'
./controller/NammuController.py:                self.logger.info("The lemmatisation returned some "
./controller/NammuController.py:                self.logger.info("The server returned some errors: ")
./controller/NammuController.py:            self.logger.info("Please, see highlighted areas and correct "
./controller/NammuController.py:            self.logger.info("The validation returned no errors.")
./controller/NammuController.py:                self.logger.info("Lemmatised ATF received from ORACC server.")
./controller/NammuController.py:                self.logger.info(formatted_server_err)
./controller/NammuController.py:        self.logger.info(server_summary_line)
./controller/NammuController.py:                        self.logger.info("Cannot disable Arabic translation"
./controller/ModelController.py:        self.logger.info("The Model View is an experimental feature, use with "
./controller/ModelController.py:            self.logger.info("The current file {} contains multiple fragments "
./controller/ModelController.py:            self.logger.info("The current file is formatted in a way that"
./view/EditSettingsView.py:            self.logger.info("Settings have been successfully updated.")
./controller/EditSettingsController.py:                self.controller.logger.error('%s missing on settings file.',
./controller/NammuController.py:            self.logger.error("WARNING: supplied file ({}) does not appear "
./controller/NammuController.py:            self.logger.error("There was an error trying to save %s.",
./controller/NammuController.py:            self.logger.error("Supplied filename: {0} does not have the "
./controller/NammuController.py:                self.logger.error("There was an error trying to save %s.",
./controller/NammuController.py:            self.logger.error(str(e))
./controller/NammuController.py:                        self.logger.error(
./controller/NammuController.py:                        self.logger.error(
./controller/NammuController.py:                self.logger.error("Unable to validate file with extension {}. "
./controller/NammuController.py:            self.logger.error("Please save file before trying to validate.")
./controller/NammuController.py:                self.logger.error(
./controller/NammuController.py:            self.logger.error("Please save file before trying to lemmatise.")
./controller/NammuController.py:            self.logger.error(
./controller/NammuController.py:            self.logger.error("Error when trying to send HTTP GET request.")
./controller/NammuController.py:            self.logger.error("Server error.")
./controller/NammuController.py:            self.logger.error("Error when trying to send last HTTP POST "
./controller/NammuController.py:                self.logger.info("The server returned some errors: \n")
./controller/NammuController.py:            self.logger.info("The validation returned no errors.")
./controller/NammuController.py:            self.logger.error('ORACC %s server timed out after 5 seconds.',
./controller/NammuController.py:            self.logger.error('You can try with a different server from the '
./controller/NammuController.py:            self.logger.error("ORACC server timed out after 5 seconds.")
./controller/NammuController.py:            self.logger.error("Can't connect to ORACC server at %s.",
./controller/NammuController.py:            self.logger.error("ORACC server returned invalid HTTP response.")
./controller/NammuController.py:                self.logger.error(
./controller/NammuController.py:                self.logger.error("Unexpected error when waiting for ORACC "
./controller/NammuController.py:            self.logger.error("There is a syntax error near character '{}' "
./controller/NammuController.py:                    self.logger.error("Project format should be "
./view/EditSettingsView.py:            self.logger.error("Invalid {} font size. Please enter a "
./view/EditSettingsView.py:            self.logger.error("Console font colour cannot match background"
./view/EditSettingsView.py:            self.logger.error("{} is not a valid working directory."
./SOAPClient/SOAPClient.py:            self.logger.error('Connection timed out when sending POST '

From that, I think we'd only need to log to the user the following:

For the debugging we were also logging:

./utils/__init__.py:        logger.debug("Comparing install and local settings files...")
./utils/__init__.py:                            logger.debug("%s: %s: %s --> Using local values.",
./utils/__init__.py:                            logger.debug("%s: %s: %s --> Using jar values.",
./utils/__init__.py:                    logger.debug("%s doesnt exist locally, creating...", key)
./utils/__init__.py:                    logger.debug("%s: %s --> Using local values.",
./utils/__init__.py:                    logger.debug("%s: %s --> Using jar values.",
./utils/__init__.py:        logger.debug("Updating version number in local config: %s --> %s",
./controller/WelcomeController.py:        self.controller.logger.debug('Settings updated.')
./controller/EditSettingsController.py:        self.controller.logger.debug("Settings updated.")
./controller/NammuController.py:                self.logger.debug("New file created from template.")
./controller/NammuController.py:        self.logger.debug("Trying to update settings' %s with value %s.",
./controller/NammuController.py:                self.logger.debug("Settings updated.")
./controller/NammuController.py:            self.logger.debug("File %s successfully closed.",
./controller/NammuController.py:                self.logger.debug("Validating ATF file %s.",
./controller/NammuController.py:                self.logger.debug("Validating ATF done.")
./controller/NammuController.py:            self.logger.debug("Lemmatising ATF file %s.", self.currentFilename)
./controller/NammuController.py:            self.logger.debug("Lemmatising ATF done.")
./controller/NammuController.py:            self.logger.debug(str(re))
./controller/NammuController.py:            self.logger.debug(str(e))
./controller/NammuController.py:        self.logger.debug("Request sent OK with ID %s", server_id)
./controller/NammuController.py:        self.logger.debug("Waiting for ORACC server to prepare response...")
./controller/NammuController.py:            self.logger.debug(str(re))
./controller/NammuController.py:            self.logger.debug(str(e))
./controller/NammuController.py:        self.logger.debug("Fetching response... ")
./controller/NammuController.py:        self.logger.debug("Reading response sent by ORACC server... ")
./controller/NammuController.py:        self.logger.debug("Printing file...")
./controller/NammuController.py:        self.logger.debug("Enabling/Disabling arabic translation mode...")
./controller/NammuController.py:        self.logger.debug("Split Editor Vertically...")
./controller/NammuController.py:        self.logger.debug("Split Editor Horizontally...")
./controller/NammuController.py:        self.logger.debug("Console...")
./controller/NammuController.py:        self.logger.debug("Toolbar... ")
./controller/NammuController.py:        self.logger.debug("Unicode...")
./controller/NammuController.py:        self.logger.debug("Undefined method " + name)
./controller/NammuController.py:        Creates logger for Nammu's functionality as well as to debug HTTP
./view/SyntaxHighlighter.py:                        logger.debug('Color not found in attribute table.')
./SOAPClient/SOAPClient.py:        self.logger.debug("Sending request to server at %s.", url)
./SOAPClient/SOAPClient.py:        self.logger.debug("HTTP request headers sent: %s", headers)
./SOAPClient/SOAPClient.py:        self.logger.debug("HTTP request body sent: %s", body)
./SOAPClient/SOAPClient.py:        self.logger.debug("The returned file from server contains: %s",
./SOAPClient/SOAPClient.py:            self.logger.debug("These are the contents of %s: \n%s",
./SOAPClient/SOAPClient.py:        Creates logger for Nammu's functionality as well as to debug HTTP

So we need to save:

About where to show these messages:

Regarding format: