Added logger global variable to have named logging in files in reviewboard.attachments

Review Request #11394 — Created Jan. 22, 2021 and discarded

ryankang
Review Board
release-4.0.x
4900
reviewboard, students

Previously logging in reviewboard/reviewboard/attachments was
un-named logging. This means it's hard to determine where the
error came from in the logs.

To fix this a global logger variable was defined in each file
that adds the location of the file to the error message.

Added unit test for unregister_mimetype_handler that passes it an
unregistered handler. This should cause an error to be logged. The
unit test listens to whether or not the logger ran.

Ran ./tests/runtests.py reviewboard.attachments and passed all 32 tests.

Summary
added logger global variable to have named logging in files in reviewboard/reviewboard/attachments/
added test that unregister handler logs when handler is unregistered
added two space after classes and fixed line that was too long
Fixed spacing of logger messages to align with start of open brackets
Changed test_unregister_handler_logger's docstring to use name of function being tested
added two blank spaces before and after logger definitions
Description From Last Updated

Please wrap your description and testing done to 80 columns. That last sentence in testing done also needs a period ...

daviddavid

Please add the bug number in the "bugs" field.

daviddavid

Please capitalize the sentence in your summary. You can also refer to "reviewboard.attachments" instead of giving the file path.

daviddavid

The diff as posted has a lot of extra stuff. It looks like you pulled on release-4.0.x but then didn't ...

daviddavid

E302 expected 2 blank lines, found 1

reviewbotreviewbot

E302 expected 2 blank lines, found 1

reviewbotreviewbot

E501 line too long (111 > 79 characters)

reviewbotreviewbot

You'll need to update the indentation of the line with the arguments to match (since "logger" is one fewer character ...

daviddavid

Let's wrap this as such: """Testing if logger in unregister_mimetype_handler is called when an unregistered handler is passed in """ ...

daviddavid

Let's add another two blank lines above this.

daviddavid

This should have two blank lines above and below it.

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

ryankang
ryankang
ryankang
david
  1. 
      
  2. Please wrap your description and testing done to 80 columns. That last sentence in testing done also needs a period at the end.

  3. Please add the bug number in the "bugs" field.

  4. Please capitalize the sentence in your summary. You can also refer to "reviewboard.attachments" instead of giving the file path.

  5. reviewboard/attachments/mimetypes.py (Diff revision 2)
     
     
     

    You'll need to update the indentation of the line with the arguments to match (since "logger" is one fewer character than "logging"). Here and all the other places you changed.

  6. reviewboard/attachments/tests.py (Diff revision 2)
     
     
     
     
     

    Let's wrap this as such:

    """Testing if logger in unregister_mimetype_handler is called when an
    unregistered handler is passed in
    """
    

    Note also that I changed the spaces to underscores in that message to match the method name.

  7. 
      
ryankang
david
  1. 
      
  2. reviewboard/attachments/mimetypes.py (Diff revision 3)
     
     

    Let's add another two blank lines above this.

  3. reviewboard/attachments/models.py (Diff revision 3)
     
     

    This should have two blank lines above and below it.

  4. 
      
ryankang
david
  1. 
      
  2. The diff as posted has a lot of extra stuff. It looks like you pulled on release-4.0.x but then didn't rebase your change. Please rebase and re-post. It's always a good idea to double check the diff view before you publish the update to make sure it looks like what you want.

  3. 
      
david
Review request changed

Status: Discarded

Loading...