Improve logging (add filename) and add help string for open_current_msg

This commit is contained in:
Paul Nameless 2020-07-04 14:14:05 +08:00
parent af7f1ee202
commit 453cdbcc45
2 changed files with 5 additions and 2 deletions

View file

@ -423,6 +423,7 @@ class Controller:
@bind(msg_handler, ["l", "^J"])
def open_current_msg(self) -> None:
"""Open msg or file with cmd in mailcap"""
msg = MsgProxy(self.model.current_msg)
self._open_msg(msg)

View file

@ -64,7 +64,7 @@ def setup_log() -> None:
handlers.append(handler)
logging.basicConfig(
format="%(levelname)-8s [%(asctime)s] %(name)s %(message)s",
format="%(levelname)s [%(asctime)s] %(filename)s:%(lineno)s - %(funcName)s | %(message)s",
handlers=handlers,
)
logging.getLogger().setLevel(config.LOG_LEVEL)
@ -200,7 +200,9 @@ class suspend:
proc = self.call(cmd)
if proc.returncode:
return proc.stderr.decode()
stderr = proc.stderr.decode()
log.error("Error happened executing <%s>:\n%s", cmd, stderr)
return stderr
return ""
def __enter__(self) -> "suspend":