)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"7637473cde88d7ade215d648885447681b797f74","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Visnusaran Murugan \u003cvisnusaran.murugan@hp.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-10-27 15:27:52 +0530"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"helper function to log and ignore exception"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I08e31146987354be35fbc9ca3533abb09ec64ece"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7a8c0949_37be8100","line":7,"updated":"2014-10-30 19:20:58.000000000","message":"Seems more like a helper object/context-manager object not a function right?","commit_id":"1ddde40d65ea396dfa3d197e39b606e7cc7bb284"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"8d8c36ad7c63da406d0afd2d440edf77aa12d556","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Visnusaran Murugan \u003cvisnusaran.murugan@hp.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-10-27 15:27:52 +0530"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"helper function to log and ignore exception"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I08e31146987354be35fbc9ca3533abb09ec64ece"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7a8c0949_a6907aed","line":7,"in_reply_to":"7a8c0949_37be8100","updated":"2014-10-31 08:38:32.000000000","message":"Agree.","commit_id":"1ddde40d65ea396dfa3d197e39b606e7cc7bb284"}],"oslo/utils/excutils.py":[{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"7637473cde88d7ade215d648885447681b797f74","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    return inner_func"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"class log_exception(object):"},{"line_number":117,"context_line":"    def __init__(self, logger):"},{"line_number":118,"context_line":"        self.logger \u003d logger"},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a8c0949_57bb0d0e","line":116,"updated":"2014-10-30 19:20:58.000000000","message":"Would be nice to add a doc-string here; something useful.","commit_id":"1ddde40d65ea396dfa3d197e39b606e7cc7bb284"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"8d8c36ad7c63da406d0afd2d440edf77aa12d556","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    return inner_func"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"class log_exception(object):"},{"line_number":117,"context_line":"    def __init__(self, logger):"},{"line_number":118,"context_line":"        self.logger \u003d logger"},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a8c0949_26a56a53","line":116,"in_reply_to":"7a8c0949_57bb0d0e","updated":"2014-10-31 08:38:32.000000000","message":"sure Joshua, Will add","commit_id":"1ddde40d65ea396dfa3d197e39b606e7cc7bb284"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"1a3b61dd1780278873bceec37743423466ac88bc","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        return self"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":131,"context_line":"        if exc_type is not None:"},{"line_number":132,"context_line":"            self.logger(traceback.format_exception(exc_type,"},{"line_number":133,"context_line":"                                                   exc_val,"},{"line_number":134,"context_line":"                                                   exc_tb))"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a8c0949_a33e9eb6","line":131,"updated":"2014-10-31 17:42:25.000000000","message":"So a question; why use traceback over just using self.logger(\"message here\", exc_info\u003d1)?\n\nSee: https://docs.python.org/2/library/logging.html\n\n\u0027\u0027There are two keyword arguments in kwargs which are inspected: exc_info which, if it does not evaluate as false, causes exception information to be added to the logging message.\u0027\u0027 So why not just use exc_info\u003dTrue?","commit_id":"158256ace27928f0ae3fb59426f0cc2bf106e62f"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"6d100c9e4bcc42f8f60a5e04a0c120a6753e2041","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        with log_exception(LOG.debug):"},{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger):"},{"line_number":125,"context_line":"        self.logger \u003d logger"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def __enter__(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a8c0949_57d2f8d2","line":124,"updated":"2014-11-05 03:03:28.000000000","message":"So only other suggestion is that you name this something other than \u0027logger\u0027; most people I think think logger is the actually logger object, while this is in your case the logger function/callable. So to avoid that confusion maybe a better variable name would be good?","commit_id":"816317a349bc9cedab4cb47b5de53fa224d5a76f"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"b4709678ed28597808cdd3a66c0835d3429325b5","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        with log_exception(LOG.debug):"},{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger):"},{"line_number":125,"context_line":"        self.logger \u003d logger"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def __enter__(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a8c0949_fa2f4b86","line":124,"in_reply_to":"7a8c0949_57d2f8d2","updated":"2014-11-05 05:26:19.000000000","message":"Yeah, thought of it. Im at a loss of function name for this. \"logger_fn\" crossed my mind, but it does not sound right. Any suggestions?","commit_id":"816317a349bc9cedab4cb47b5de53fa224d5a76f"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"6ba605071ac7e10c9d21abce4d7d120b81e5389d","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        with log_exception(LOG.debug):"},{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger):"},{"line_number":125,"context_line":"        self.logger \u003d logger"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def __enter__(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a8c0949_5173cf7f","line":124,"in_reply_to":"7a8c0949_6acb7b53","updated":"2014-11-06 11:02:15.000000000","message":"The second option sounds good. :)","commit_id":"816317a349bc9cedab4cb47b5de53fa224d5a76f"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"747d4884842c739da1d9c10031e2329567dbf585","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        with log_exception(LOG.debug):"},{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger):"},{"line_number":125,"context_line":"        self.logger \u003d logger"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def __enter__(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a8c0949_6acb7b53","line":124,"in_reply_to":"7a8c0949_fa2f4b86","updated":"2014-11-05 21:34:10.000000000","message":"Maybe \u0027logger_func\u0027 (although I\u0027m not very good with names either).\n\nThe other option is to take a logger (the actually logger object) and a log level, and then in the exit method call into self.logger.log(self.level, message) instead? That way people don\u0027t need to pass in a function and can just provide these instead.\n\nhttps://docs.python.org/2/library/logging.html#logging.log","commit_id":"816317a349bc9cedab4cb47b5de53fa224d5a76f"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"11dfa5aa2135a513a27f62bfa32bf5d58d60013f","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger, level):"},{"line_number":125,"context_line":"        self.logger_func \u003d getattr(logger, level)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def __enter__(self):"},{"line_number":128,"context_line":"        return self"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a8c0949_ff71d6e0","line":125,"updated":"2014-11-07 08:40:09.000000000","message":"hmmm, why do getattr() instead of just saving both the logger and the level and using logger.log(level, message)?","commit_id":"8d55b699baf819a888385d8a684e65ef33dcca40"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"0421ea51c647909f689fda08d639a22bb9162e5b","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger, level):"},{"line_number":125,"context_line":"        self.logger_func \u003d getattr(logger, level)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def __enter__(self):"},{"line_number":128,"context_line":"        return self"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a8c0949_42d92d82","line":125,"in_reply_to":"7a8c0949_ff71d6e0","updated":"2014-11-07 08:51:11.000000000","message":"I was hoping, it would be nice for user to send a \"string\" level flag rather than an integer like logging.DEBUG, Will submit another patch set :(","commit_id":"8d55b699baf819a888385d8a684e65ef33dcca40"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"8de9ba417ab79fb6ba47ba1313beaf3697ccbba7","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    return inner_func"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"class log_exception(object):"},{"line_number":117,"context_line":"    \"\"\"Trap and ignore exception. Uses user provided"},{"line_number":118,"context_line":"    logger to log exception."},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_935ad24e","line":116,"updated":"2014-11-19 21:27:40.000000000","message":"It\u0027s kind of verbose, but I\u0027m wondering if log_and_ignore_exception wouldn\u0027t be a better name for this.  I wouldn\u0027t -1 for that alone, but I wanted to put it out there to see what people think.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"0a5740714b068c5a8fa5ea704d95d6bdaed7ac77","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    return inner_func"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"class log_exception(object):"},{"line_number":117,"context_line":"    \"\"\"Trap and ignore exception. Uses user provided"},{"line_number":118,"context_line":"    logger to log exception."},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_8f518332","line":116,"in_reply_to":"5a890539_935ad24e","updated":"2015-01-14 09:15:12.000000000","message":"Yeah, and_ignore is explicit. will alter.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":5638,"name":"Davanum Srinivas","email":"davanum@gmail.com","username":"dims-v"},"change_message_id":"4f8d1172a99ebb09626d1fa2ca3ee842dcbf4b09","unresolved":false,"context_lines":[{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    Usage:"},{"line_number":121,"context_line":"        with log_exception(LOG, logging.DEBUG):"},{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger, level):"},{"line_number":125,"context_line":"        self.logger \u003d logger"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_8fc3de36","line":122,"updated":"2014-11-17 18:11:29.000000000","message":"tiny nit - \"somthing\" should be \"something\"","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"16ef00600e583e88c3e7ace71eff593fe29650d4","unresolved":false,"context_lines":[{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    Usage:"},{"line_number":121,"context_line":"        with log_exception(LOG, logging.DEBUG):"},{"line_number":122,"context_line":"            # Do somthing that might raise exception"},{"line_number":123,"context_line":"    \"\"\""},{"line_number":124,"context_line":"    def __init__(self, logger, level):"},{"line_number":125,"context_line":"        self.logger \u003d logger"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_62ecfb2a","line":122,"in_reply_to":"5a890539_8fc3de36","updated":"2014-11-18 04:45:37.000000000","message":"will do.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"8de9ba417ab79fb6ba47ba1313beaf3697ccbba7","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        return self"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_f3bb1673","line":132,"updated":"2014-11-19 21:27:40.000000000","message":"This is going to catch and ignore _all_ exceptions, which is something we typically frown upon.  We should allow specifying a list or tuple of exception types in the constructor that we want to handle.\n\nI would probably take that as a follow up change, but I do think it needs to be done.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"673542b1bf0fb12d1e0440a94712cbaf28c3d442","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        return self"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_4c14c0e8","line":132,"in_reply_to":"5a890539_01c011df","updated":"2014-11-24 23:48:24.000000000","message":"Probably, for the sake of consistency with a regular exception handler (except: with no type specified catches everything too), but it might be worth noting in the docstring that you should almost never do that (again, like you should almost never use bare except:.  We actually have a hacking rule to disallow that).","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"604cc3f51d4949ceb890fc4de7ccc4ab08ed4759","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        return self"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_01c011df","line":132,"in_reply_to":"5a890539_f3bb1673","updated":"2014-11-21 06:26:43.000000000","message":"Is it OK to catch all if the exception list is empty?","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"1630dd380e7545d225119826d1f4e07818a9f880","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_3283b357","line":133,"updated":"2014-11-12 18:13:56.000000000","message":"Doesnt \u0027six.text_type(exc_val)\u0027 happen automatically?","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"8de9ba417ab79fb6ba47ba1313beaf3697ccbba7","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_336d9e05","line":133,"in_reply_to":"5a890539_2ff05466","updated":"2014-11-19 21:27:40.000000000","message":"That\u0027s a different situation though.  Logging exc_val directly is working fine for me.  I\u0027m not hung up on it, but I wanted to note that it works fine without the six.text_type.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"754ec65a9b8e84012891844b7faa8781ef0e3108","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_4e1061a8","line":133,"in_reply_to":"5a890539_3283b357","updated":"2014-11-14 05:00:06.000000000","message":"I do not think it happens automatically. Heat so far has be manually converting strings before passing it for logging\n\nhttps://github.com/openstack/heat/blob/master/heat/engine/service.py#L558","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"604cc3f51d4949ceb890fc4de7ccc4ab08ed4759","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_a1581d57","line":133,"in_reply_to":"5a890539_336d9e05","updated":"2014-11-21 06:26:43.000000000","message":"Not sure if it will work without six.text_type.\n\nPlease have a look @ https://review.openstack.org/#/c/123600/1/heat/api/openstack/v1/stacks.py","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"b686a3de85d65461075a9f55d9507706842ee83f","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_2ff05466","line":133,"in_reply_to":"5a890539_4e1061a8","updated":"2014-11-14 22:13:30.000000000","message":"Ok, odd, but I guess this should be fine.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"673542b1bf0fb12d1e0440a94712cbaf28c3d442","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":132,"context_line":"        if exc_type is not None:"},{"line_number":133,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":134,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_2cee94ed","line":133,"in_reply_to":"5a890539_a1581d57","updated":"2014-11-24 23:48:24.000000000","message":"I\u0027m surprised by that, but like I said I\u0027m not that bothered by it the way it is so I\u0027m fine leaving it.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"}],"oslo_utils/excutils.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7599b49f16c61056ecdcc8ed4c8a2c039f55ac13","unresolved":false,"context_lines":[{"line_number":116,"context_line":"class log_and_ignore_exception(object):"},{"line_number":117,"context_line":"    \"\"\"Trap and ignore exception types mentioned in"},{"line_number":118,"context_line":"    exc_types tuple. Logs all exceptions using logger."},{"line_number":119,"context_line":"    An empty exc_types will raise all exceptions."},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    Usage:"},{"line_number":122,"context_line":"        with log_and_ignore_xception(LOG, logging.DEBUG):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_dea4b108","line":119,"updated":"2015-01-16 18:28:13.000000000","message":"This behavior actually seems like a separate context (probably called log_exception like the original version was).  As-is, wrapping this around code without exc_types set would essentially become an exception logger, which is not something I think we generally want to do.\n\nMy understanding from our previous discussions was that an empty exc_types would catch and ignore all exceptions, which is not recommended but I think would be more consistent.\n\nMaybe we could just default exc_types to (Exception,)?","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"bb00ef0828d9bf7081244a5c084b83dddd8d484f","unresolved":false,"context_lines":[{"line_number":116,"context_line":"class log_and_ignore_exception(object):"},{"line_number":117,"context_line":"    \"\"\"Trap and ignore exception types mentioned in"},{"line_number":118,"context_line":"    exc_types tuple. Logs all exceptions using logger."},{"line_number":119,"context_line":"    An empty exc_types will raise all exceptions."},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    Usage:"},{"line_number":122,"context_line":"        with log_and_ignore_xception(LOG, logging.DEBUG):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_aaa4f506","line":119,"in_reply_to":"3a961159_dea4b108","updated":"2015-01-17 13:33:26.000000000","message":"Sure. I\u0027ll default Exception. Made it empty since catching all is not recommended as you had pointed out.","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7599b49f16c61056ecdcc8ed4c8a2c039f55ac13","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    An empty exc_types will raise all exceptions."},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    Usage:"},{"line_number":122,"context_line":"        with log_and_ignore_xception(LOG, logging.DEBUG):"},{"line_number":123,"context_line":"            # Do something that might raise exception"},{"line_number":124,"context_line":"    \"\"\""},{"line_number":125,"context_line":"    def __init__(self, logger, level, exc_types\u003d()):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_5bdc53e1","line":122,"updated":"2015-01-16 18:28:13.000000000","message":"Typo in \"exception\"","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"bb00ef0828d9bf7081244a5c084b83dddd8d484f","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    An empty exc_types will raise all exceptions."},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    Usage:"},{"line_number":122,"context_line":"        with log_and_ignore_xception(LOG, logging.DEBUG):"},{"line_number":123,"context_line":"            # Do something that might raise exception"},{"line_number":124,"context_line":"    \"\"\""},{"line_number":125,"context_line":"    def __init__(self, logger, level, exc_types\u003d()):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_caaea1e6","line":122,"in_reply_to":"3a961159_5bdc53e1","updated":"2015-01-17 13:33:26.000000000","message":":( Will do","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7599b49f16c61056ecdcc8ed4c8a2c039f55ac13","unresolved":false,"context_lines":[{"line_number":132,"context_line":""},{"line_number":133,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":134,"context_line":"        if exc_type is not None:"},{"line_number":135,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":136,"context_line":"            if exc_type in self.exc_types:"},{"line_number":137,"context_line":"                return True"},{"line_number":138,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_7b63cf19","line":135,"updated":"2015-01-16 18:28:13.000000000","message":"This is going to log all exceptions, even if they aren\u0027t in the list.  We don\u0027t want to do that.","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"bb00ef0828d9bf7081244a5c084b83dddd8d484f","unresolved":false,"context_lines":[{"line_number":132,"context_line":""},{"line_number":133,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":134,"context_line":"        if exc_type is not None:"},{"line_number":135,"context_line":"            self.logger.log(self.level, six.text_type(exc_val), exc_info\u003dTrue)"},{"line_number":136,"context_line":"            if exc_type in self.exc_types:"},{"line_number":137,"context_line":"                return True"},{"line_number":138,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_eaa99ddd","line":135,"in_reply_to":"3a961159_7b63cf19","updated":"2015-01-17 13:33:26.000000000","message":"ok. Got it.","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"a954e38ba4a1de8a0a052c25c4ab23638353070f","unresolved":false,"context_lines":[{"line_number":137,"context_line":"                self.logger.log(self.level, six.text_type(exc_val),"},{"line_number":138,"context_line":"                                exc_info\u003dTrue)"},{"line_number":139,"context_line":"                return True"},{"line_number":140,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_a726b1b8","line":140,"updated":"2015-01-21 21:57:41.000000000","message":"Nit: This should probably be indented one less level.  It should be fine though since it will fall through and return None, which also evaluates to False.","commit_id":"2859b16cf5bc76ed243fbb7eba84fce98cadc9e5"}],"tests/test_excutils.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"8de9ba417ab79fb6ba47ba1313beaf3697ccbba7","unresolved":false,"context_lines":[{"line_number":208,"context_line":"            except Exception as _e:"},{"line_number":209,"context_line":"                e \u003d _e"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        self.assertEqual(e, None)"},{"line_number":212,"context_line":"        self.assertTrue(log.called)"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_93f572cd","line":211,"updated":"2014-11-19 21:27:40.000000000","message":"This should be self.assertIsNone(e)","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"604cc3f51d4949ceb890fc4de7ccc4ab08ed4759","unresolved":false,"context_lines":[{"line_number":208,"context_line":"            except Exception as _e:"},{"line_number":209,"context_line":"                e \u003d _e"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        self.assertEqual(e, None)"},{"line_number":212,"context_line":"        self.assertTrue(log.called)"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_c1536937","line":211,"in_reply_to":"5a890539_93f572cd","updated":"2014-11-21 06:26:43.000000000","message":"ok","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"8de9ba417ab79fb6ba47ba1313beaf3697ccbba7","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                e \u003d _e"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        self.assertEqual(e, None)"},{"line_number":212,"context_line":"        self.assertTrue(log.called)"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_73cd6686","line":212,"updated":"2014-11-19 21:27:40.000000000","message":"It\u0027s a little weird to me that this is outside the with block.  I guess it\u0027s working, but it makes me nervous to be referencing a context after we\u0027ve left it.  I don\u0027t know if there\u0027s any guarantee that the state is still valid at this point.\n\nAlso, kind of a nit, but it would be nice to assert the call args too so we know the specified log level is being used and such.","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"604cc3f51d4949ceb890fc4de7ccc4ab08ed4759","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                e \u003d _e"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        self.assertEqual(e, None)"},{"line_number":212,"context_line":"        self.assertTrue(log.called)"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_612555c1","line":212,"in_reply_to":"5a890539_73cd6686","updated":"2014-11-21 06:26:43.000000000","message":"will assert call args","commit_id":"301acc97cfd5358c909556055caf0de0eba1e027"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7599b49f16c61056ecdcc8ed4c8a2c039f55ac13","unresolved":false,"context_lines":[{"line_number":198,"context_line":""},{"line_number":199,"context_line":"class LogAndIgnoreException(test_base.BaseTestCase):"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"    def test_log_exception(self):"},{"line_number":202,"context_line":"        e \u003d None"},{"line_number":203,"context_line":"        msg \u003d \u0027foo\u0027"},{"line_number":204,"context_line":"        log \u003d None"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_3ee3f534","line":201,"updated":"2015-01-16 18:28:13.000000000","message":"Can we also get a test case where the exception raised is not supposed to be caught by the context?  That\u0027s the other important case here.","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"f77e47e6d8f868a52b7d259252d7cd73fbb68147","unresolved":false,"context_lines":[{"line_number":198,"context_line":""},{"line_number":199,"context_line":"class LogAndIgnoreException(test_base.BaseTestCase):"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"    def test_log_exception(self):"},{"line_number":202,"context_line":"        e \u003d None"},{"line_number":203,"context_line":"        msg \u003d \u0027foo\u0027"},{"line_number":204,"context_line":"        log \u003d None"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_8a78197f","line":201,"in_reply_to":"3a961159_3ee3f534","updated":"2015-01-17 13:34:06.000000000","message":"sure","commit_id":"5a85db137b9e4afe6e58ba817bc89105ccc16b50"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"a954e38ba4a1de8a0a052c25c4ab23638353070f","unresolved":false,"context_lines":[{"line_number":224,"context_line":"                with excutils.log_and_ignore_exception(logging,"},{"line_number":225,"context_line":"                                                       logging.ERROR,"},{"line_number":226,"context_line":"                                                       (Exception,)):"},{"line_number":227,"context_line":"                    raise SyntaxError(msg)"},{"line_number":228,"context_line":"            except Exception as _e:"},{"line_number":229,"context_line":"                e \u003d _e"},{"line_number":230,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"1a930d6b_47934da3","line":227,"updated":"2015-01-21 21:57:41.000000000","message":"Hmm, this inherits from Exception, so the intuitive thing would be for this to get caught when Exception is the list of things to look for (like a \"try...except Exception\" block would).  I think we need to change the context manager to handle inheritance.","commit_id":"2859b16cf5bc76ed243fbb7eba84fce98cadc9e5"},{"author":{"_account_id":8537,"name":"Visnusaran Murugan","email":"visnusaran.murugan@hp.com","username":"Vishnu"},"change_message_id":"67e63b118d8697e05ec577be10f31fe128b51a5b","unresolved":false,"context_lines":[{"line_number":224,"context_line":"                with excutils.log_and_ignore_exception(logging,"},{"line_number":225,"context_line":"                                                       logging.ERROR,"},{"line_number":226,"context_line":"                                                       (Exception,)):"},{"line_number":227,"context_line":"                    raise SyntaxError(msg)"},{"line_number":228,"context_line":"            except Exception as _e:"},{"line_number":229,"context_line":"                e \u003d _e"},{"line_number":230,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_2056a52a","line":227,"in_reply_to":"1a930d6b_47934da3","updated":"2015-02-05 06:34:11.000000000","message":"class BaseEx:\n    pass\n\nclass X(Base):\n    pass\n\nclass A(X)\n    pass\n\nclass B(X):\n    pass\n\nSo if i understand correctly\nIf I am interested in trapping B, I should also look out for B, X and BaseEx as well.\nBut ignore X and BaseEx if the exception raised is A","commit_id":"2859b16cf5bc76ed243fbb7eba84fce98cadc9e5"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"5d4a0d98048acd72eddd1f245e556e6090a758da","unresolved":false,"context_lines":[{"line_number":224,"context_line":"                with excutils.log_and_ignore_exception(logging,"},{"line_number":225,"context_line":"                                                       logging.ERROR,"},{"line_number":226,"context_line":"                                                       (Exception,)):"},{"line_number":227,"context_line":"                    raise SyntaxError(msg)"},{"line_number":228,"context_line":"            except Exception as _e:"},{"line_number":229,"context_line":"                e \u003d _e"},{"line_number":230,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_5e4d23c3","line":227,"in_reply_to":"da86d52c_2056a52a","updated":"2015-02-05 17:23:47.000000000","message":"Not quite,  except B: would not catch a BaseEx because that is not an instance of B.  except BaseEx: should catch a B exception, however, because B is a BaseEx.\n\nConsider the following code with regular exception handlers:\n\n class TestException(Exception):\n   pass\n\n try:\n   raise TestException()\n except Exception:\n   print \u0027Ignoring exception\u0027\n   \n try:\n   raise Exception()\n except TestException:\n   print \u0027Ignoring exception\u0027\n\nThis results in the output:\n\n Ignoring exception\n Traceback (most recent call last):\n  File \"./test.py\", line 28, in \u003cmodule\u003e\n    raise Exception()\n Exception\n\nThe first is caught and ignored because TestException is a subclass of Exception.  The second one is not caught because Exception is _not_ a subclass of TestException.\n\nI think the context needs to behave the same way to avoid confusing people who expect it to behave as a regular exception handler.","commit_id":"2859b16cf5bc76ed243fbb7eba84fce98cadc9e5"}]}
