| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Breakpad for Python. | 5 """Breakpad for Python. |
| 6 | 6 |
| 7 Sends a notification when a process stops on an exception. | 7 Sends a notification when a process stops on an exception. |
| 8 | 8 |
| 9 It is only enabled when all these conditions are met: | 9 It is only enabled when all these conditions are met: |
| 10 1. hostname finishes with '.google.com' or 'chromium.org' | 10 1. hostname finishes with '.google.com' or 'chromium.org' |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 params = { | 82 params = { |
| 83 'args': sys.argv, | 83 'args': sys.argv, |
| 84 'stack': stack[0:4096], | 84 'stack': stack[0:4096], |
| 85 'user': getpass.getuser(), | 85 'user': getpass.getuser(), |
| 86 'exception': FormatException(last_tb), | 86 'exception': FormatException(last_tb), |
| 87 'host': _HOST_NAME, | 87 'host': _HOST_NAME, |
| 88 'cwd': os.getcwd(), | 88 'cwd': os.getcwd(), |
| 89 'version': sys.version, | 89 'version': sys.version, |
| 90 } | 90 } |
| 91 # pylint: disable=W0702 | 91 # pylint: disable=W0702 |
| 92 print('\n'.join(' %s: %s' % (k, v[0:maxlen]) | 92 print('\n'.join(' %s: %s' % (k, params[k][0:maxlen]) |
| 93 for k, v in params.iteritems())) | 93 for k in sorted(params))) |
| 94 print(post(url, params)) | 94 print(post(url, params)) |
| 95 except IOError: | 95 except IOError: |
| 96 print('There was a failure while trying to send the stack trace. Too bad.') | 96 print('There was a failure while trying to send the stack trace. Too bad.') |
| 97 | 97 |
| 98 | 98 |
| 99 def SendProfiling(url=None): | 99 def SendProfiling(url=None): |
| 100 try: | 100 try: |
| 101 if not url: | 101 if not url: |
| 102 url = DEFAULT_URL + '/profiling' | 102 url = DEFAULT_URL + '/profiling' |
| 103 params = { | 103 params = { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 # Skip unit tests and we don't want anything from non-googler. | 136 # Skip unit tests and we don't want anything from non-googler. |
| 137 if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and | 137 if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and |
| 138 not 'NO_BREAKPAD' in os.environ and | 138 not 'NO_BREAKPAD' in os.environ and |
| 139 (_HOST_NAME.endswith('.google.com') or | 139 (_HOST_NAME.endswith('.google.com') or |
| 140 _HOST_NAME.endswith('.chromium.org'))): | 140 _HOST_NAME.endswith('.chromium.org'))): |
| 141 Register() | 141 Register() |
| 142 | 142 |
| 143 # Uncomment this line if you want to test it out. | 143 # Uncomment this line if you want to test it out. |
| 144 #Register() | 144 #Register() |
| OLD | NEW |