-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENH]: CLI log path parameter support (#1631)
Refs: #1624, #1591 ## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Added `--log--path` support to the CLI. A naive implementation that works with Chroma's `log_config.yml` ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python ## Documentation Changes TBD
- Loading branch information
Showing
3 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Any, Dict | ||
|
||
import yaml | ||
|
||
|
||
def set_log_file_path(log_config_path: str, new_filename: str = "chroma.log") -> Dict[str, Any]: | ||
"""This works with the standard log_config.yml file. | ||
It will not work with custom log configs that may use different handlers""" | ||
with open(f"{log_config_path}", 'r') as file: | ||
log_config = yaml.safe_load(file) | ||
for handler in log_config['handlers'].values(): | ||
if handler.get('class') == 'logging.handlers.RotatingFileHandler': | ||
handler['filename'] = new_filename | ||
|
||
return log_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters