feat: let pylance use sub-level logger of logging#3206
feat: let pylance use sub-level logger of logging#3206wjones127 merged 1 commit intolance-format:mainfrom
Conversation
41eb453 to
a437e7d
Compare
|
cc @westonpace @wjones127 Please have a look, thanks. |
wjones127
left a comment
There was a problem hiding this comment.
This seems alright. Though most of our logging happens at the Rust layer. That does make me wonder if it is even that valuable to let users tweak the logger, given it only controls a small fraction of our logs.
I made a suggestion on how they could share configuration. Otherwise, I think this seems fine.
| import os | ||
| from typing import Optional | ||
|
|
||
| ENV_NAME_PYLANCE_LOGGING_LEVEL = "PYLANCE_LOGGING_LEVEL" |
There was a problem hiding this comment.
We already have a logging level for pylance defined as LANCE_LOG
However, the syntax is a bit more complex:
LANCE_LOG=[target][=][level][,...]
For example:
LANCE_LOG=lance-core=debug,info
Means provide lance-core logs at debug level, everything else at info level.
I think it might be preferable to re-use and parse that environment variable.
Something like:
def get_log_level():
lance_log = os.environ.get("LANCE_LOG", "INFO").upper()
lance_log = [entry for entry in lance_log.split(',')
if '=' not in entry]
if len(lance_log) > 0:
return lance_log[0]
else:
return "INFO"There was a problem hiding this comment.
Thanks for your explanation. Reasonable. Accept.
By the way, it seems there is no description about the env LANCE_LOG in the whole codebase(not sure about documentation in the official site).
If you agree, we should document it for users. WDYT?
a437e7d to
fe43947
Compare
fe43947 to
3dc5e26
Compare
wjones127
left a comment
There was a problem hiding this comment.
Nice work. And agreed, we should add some documentation about the logging settings.
Closes #3195