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

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

Information

Review Board
release-4.0.x

Reviewers

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 ID
added logger global variable to have named logging in files in reviewboard/reviewboard/attachments/
af955d6577f0c7a5c14f95c82ad42a3a0810ab58
added test that unregister handler logs when handler is unregistered
aa0b092d17a7b02fcc31d5df99c84226da95bdda
added two space after classes and fixed line that was too long
b7f46628bd891c9c1150c845d3d68ef9562ae13b
Fixed spacing of logger messages to align with start of open brackets
53b24fff73becb17cb2211ad1f8f415a6157c4ca
Changed test_unregister_handler_logger's docstring to use name of function being tested
c2192c199be7af0d54bb2a58c635a7861ee45238
added two blank spaces before and after logger definitions
f4d9c978375b910815ea90fff71bfbd19ce91635
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. Show all issues

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

  3. Show all issues

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

  4. Show all issues

    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)
     
     
     
    Show all issues

    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)
     
     
     
     
     
    Show all issues

    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)
     
     
    Show all issues

    Let's add another two blank lines above this.

  3. reviewboard/attachments/models.py (Diff revision 3)
     
     
    Show all issues

    This should have two blank lines above and below it.

  4. 
      
ryankang
david
  1. 
      
  2. Show all issues

    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...