mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
lib.FileContext.log_name: Beautify
Prepend the class name to .log_name. Not sure if that makes logs more legible, but we'll try it out for a while. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
4f98fd6c78
commit
0d6eeeadcf
1 changed files with 6 additions and 4 deletions
|
|
@ -33,14 +33,16 @@ class FileContext(abc.ABC):
|
|||
@property
|
||||
def log_name(self) -> str:
|
||||
if self.__log_name is None:
|
||||
self.__log_name = self.__class__.__name__.lower()
|
||||
from urllib.parse import urlparse
|
||||
parsed = urlparse(self.__uri)
|
||||
ret: list[str] = []
|
||||
uri: list[str] = []
|
||||
if parsed.scheme:
|
||||
ret.append(parsed.scheme)
|
||||
uri.append(parsed.scheme)
|
||||
if parsed.hostname:
|
||||
ret.append(parsed.hostname)
|
||||
self.__log_name = '://'.join(ret) if ret else 'local'
|
||||
uri.append(parsed.hostname)
|
||||
if uri:
|
||||
self.__log_name += ' ' + '://'.join(uri)
|
||||
return self.__log_name
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue