mirror of
https://github.com/clearml/clearml
synced 2025-05-01 03:23:09 +00:00
Use UID in message if user name cannot be retrieved
This commit is contained in:
parent
7085a2bb74
commit
6746144803
@ -24,9 +24,26 @@ from ..debugging.log import get_logger
|
|||||||
|
|
||||||
|
|
||||||
def make_message(s, **kwargs):
|
def make_message(s, **kwargs):
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
user = getpass.getuser()
|
||||||
|
except Exception:
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
import os
|
||||||
|
user = '{}'.format(os.getuid())
|
||||||
|
except Exception:
|
||||||
|
user = 'unknown'
|
||||||
|
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
host = gethostname()
|
||||||
|
except Exception:
|
||||||
|
host = 'localhost'
|
||||||
|
|
||||||
args = dict(
|
args = dict(
|
||||||
user=getpass.getuser(),
|
user=user,
|
||||||
host=gethostname(),
|
host=host,
|
||||||
time=datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
|
time=datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
)
|
)
|
||||||
args.update(kwargs)
|
args.update(kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user