Skip to content

Commit 8405853

Browse files
improve connection log display
1 parent 81ad972 commit 8405853

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

datajoint/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None)
195195
connect_host_hook(self)
196196
if self.is_connected:
197197
logger.info(
198-
"DataJoint {version} connected {user}@{host}:{port}".format(
198+
"DataJoint {version} connected to {user}@{host}:{port}".format(
199199
version=__version__, **self.conn_info
200200
)
201201
)

datajoint/settings.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def load(self, filename):
118118
if filename is None:
119119
filename = LOCALCONFIG
120120
with open(filename, "r") as fid:
121-
logger.info(f"Reading dj.config from {filename}")
121+
logger.info(f"DataJoint is configured from {os.path.abspath(filename)}")
122122
self._conf.update(json.load(fid))
123123

124124
def save_local(self, verbose=False):
@@ -254,7 +254,7 @@ def __setitem__(self, key, value):
254254
if key == "loglevel":
255255
if value not in valid_logging_levels:
256256
raise ValueError(
257-
f"{'value'} is not a valid logging value {tuple(valid_logging_levels)}"
257+
f"'{value}' is not a valid logging value {tuple(valid_logging_levels)}"
258258
)
259259
logger.setLevel(value)
260260

@@ -265,11 +265,9 @@ def __setitem__(self, key, value):
265265
os.path.expanduser(n) for n in (LOCALCONFIG, os.path.join("~", GLOBALCONFIG))
266266
)
267267
try:
268-
config_file = next(n for n in config_files if os.path.exists(n))
268+
config.load(next(n for n in config_files if os.path.exists(n)))
269269
except StopIteration:
270-
pass
271-
else:
272-
config.load(config_file)
270+
logger.info("No config file was found.")
273271

274272
# override login credentials with environment variables
275273
mapping = {
@@ -298,7 +296,7 @@ def __setitem__(self, key, value):
298296
if v is not None
299297
}
300298
if mapping:
301-
logger.info(f"Loaded settings {tuple(mapping)} from environment variables.")
299+
logger.info(f"Overloaded settings {tuple(mapping)} from environment variables.")
302300
config.update(mapping)
303301

304302
logger.setLevel(log_levels[config["loglevel"]])

0 commit comments

Comments
 (0)