load_or_create_master_key. Internal helper function. This docstring was added automatically to improve maintainability. Returns: Varies.
()
| 412 | DEVICE_ID = load_or_create_device_id() |
| 413 | |
| 414 | |
| 415 | logging.basicConfig( |
| 416 | filename=LOG_PATH, |
| 417 | level=logging.INFO, |
| 418 | format="%(asctime)s %(levelname)s %(message)s", |
| 419 | ) |
| 420 | log = logging.getLogger("butsystem") |
| 421 | |
| 422 | _TERMUX_ERROR_LOCK = threading.RLock() |
| 423 | _TERMUX_ERROR_BUFFER = [] |
| 424 | _TERMUX_ERROR_MONITOR_ACTIVE = False |
| 425 | |
| 426 | |
| 427 | class _TermuxErrorBufferHandler(logging.Handler): |
| 428 | """Buffer startup errors and print future errors beneath the link block.""" |
| 429 | |
| 430 | def __init__(self): |
| 431 | super().__init__(level=logging.ERROR) |
| 432 | self.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(name)s: %(message)s")) |
| 433 | |
| 434 | def emit(self, record): |
| 435 | try: |
| 436 | rendered = self.format(record) |
| 437 | if record.exc_info: |
| 438 | rendered += "\n" + "".join(traceback.format_exception(*record.exc_info)).rstrip() |
| 439 | with _TERMUX_ERROR_LOCK: |
| 440 | if _TERMUX_ERROR_MONITOR_ACTIVE: |