Revision 20601361 lib/utils.py
b/lib/utils.py | ||
---|---|---|
1769 | 1769 |
# By declaring this variable as a pointer to an integer we can then access |
1770 | 1770 |
# its value correctly, should the mlockall call fail, in order to see what |
1771 | 1771 |
# the actual error code was. |
1772 |
# pylint: disable-msg=W0212 |
|
1772 | 1773 |
libc.__errno_location.restype = ctypes.POINTER(ctypes.c_int) |
1773 | 1774 |
|
1774 | 1775 |
if libc.mlockall(_MCL_CURRENT | _MCL_FUTURE): |
1776 |
# pylint: disable-msg=W0212 |
|
1775 | 1777 |
logging.error("Cannot set memory lock: %s", |
1776 | 1778 |
os.strerror(libc.__errno_location().contents.value)) |
1777 | 1779 |
return |
... | ... | |
2084 | 2086 |
logging.FileHandler.__init__(self, filename, mode, encoding) |
2085 | 2087 |
self.console = open(constants.DEV_CONSOLE, "a") |
2086 | 2088 |
|
2087 |
def handleError(self, record): |
|
2089 |
def handleError(self, record): # pylint: disable-msg=C0103
|
|
2088 | 2090 |
"""Handle errors which occur during an emit() call. |
2089 | 2091 |
|
2090 | 2092 |
Try to handle errors with FileHandler method, if it fails write to |
... | ... | |
2093 | 2095 |
""" |
2094 | 2096 |
try: |
2095 | 2097 |
logging.FileHandler.handleError(self, record) |
2096 |
except Exception: |
|
2098 |
except Exception: # pylint: disable-msg=W0703
|
|
2097 | 2099 |
try: |
2098 | 2100 |
self.console.write("Cannot log message:\n%s\n" % self.format(record)) |
2099 |
except Exception: |
|
2101 |
except Exception: # pylint: disable-msg=W0703
|
|
2100 | 2102 |
# Log handler tried everything it could, now just give up |
2101 | 2103 |
pass |
2102 | 2104 |
|
Also available in: Unified diff