Closed josekasna closed 3 months ago
Awesome thanks so much for the PR!
One thing I noticed is when running with log level debug and filtering there are debug log messages getting written over the screen rather than to the log file:
My config file:
cat ~/.config/gollama/config.json
{
"default_sort": "Size",
"columns": [
"Name",
"Size",
"Quant",
"Family",
"Modified",
"ID"
],
"ollama_api_key": "",
"ollama_api_url": "",
"lm_studio_file_paths": "",
"log_level": "debug",
"log_file_path": "/Users/samm/.config/gollama/gollama.log",
"sort_order": "",
"strip_string": "",
"editor": "",
"docker_container": ""
}
I just ran make test which is great to see run, but it blew away my config:
$ make test
go test -v ./...
=== RUN TestRunModel
=== RUN TestRunModel/Run_with_Docker
=== RUN TestRunModel/Run_without_Docker
=== RUN TestRunModel/Run_with_Docker_set_to_false
--- PASS: TestRunModel (0.00s)
--- PASS: TestRunModel/Run_with_Docker (0.00s)
--- PASS: TestRunModel/Run_without_Docker (0.00s)
--- PASS: TestRunModel/Run_with_Docker_set_to_false (0.00s)
PASS
ok github.com/sammcj/gollama 0.376s
=== RUN TestLoadConfig
=== RUN TestLoadConfig/Config_file_exists_and_is_valid
=== RUN TestLoadConfig/Config_file_does_not_exist
5:14PM DBG Config file does not exist, creating with default values
Config file does not exist, creating with default values
5:14PM DBG Saving config to: /Users/samm/.config/gollama/config.json
=== RUN TestLoadConfig/Config_file_is_invalid
--- PASS: TestLoadConfig (0.00s)
--- PASS: TestLoadConfig/Config_file_exists_and_is_valid (0.00s)
--- PASS: TestLoadConfig/Config_file_does_not_exist (0.00s)
--- PASS: TestLoadConfig/Config_file_is_invalid (0.00s)
=== RUN TestSaveConfig
=== RUN TestSaveConfig/Valid_config_save
5:14PM DBG Saving config to: /Users/samm/.config/gollama/config.json
--- PASS: TestSaveConfig (0.00s)
--- PASS: TestSaveConfig/Valid_config_save (0.00s)
PASS
ok github.com/sammcj/gollama/config 0.633s
=== RUN TestInit
=== RUN TestInit/Valid_debug_log_level_with_valid_log_file_path
5:15PM INF This is an info message
5:15PM ERR This is an error message
5:15PM DBG This is a debug message
=== RUN TestInit/Valid_info_log_level_with_valid_log_file_path
5:15PM INF This is an info message
5:15PM ERR This is an error message
=== RUN TestInit/Invalid_log_file_path
=== RUN TestInit/Empty_log_file_path_(use_default)
5:15PM INF This is an info message
5:15PM ERR This is an error message
=== RUN TestInit/Log_file_path_with_home_directory_(~)
5:15PM INF This is an info message
5:15PM ERR This is an error message
5:15PM DBG This is a debug message
--- PASS: TestInit (0.01s)
--- PASS: TestInit/Valid_debug_log_level_with_valid_log_file_path (0.00s)
--- PASS: TestInit/Valid_info_log_level_with_valid_log_file_path (0.00s)
--- PASS: TestInit/Invalid_log_file_path (0.00s)
--- PASS: TestInit/Empty_log_file_path_(use_default) (0.01s)
--- PASS: TestInit/Log_file_path_with_home_directory_(~) (0.00s)
PASS
ok github.com/sammcj/gollama/logging 0.889s
$ cat /Users/samm/.config/gollama/config.json (logging-tests-features)
{
"default_sort": "Name",
"columns": [
"Name",
"Size"
],
"ollama_api_key": "testkey",
"ollama_api_url": "http://testurl",
"lm_studio_file_paths": "/test/path",
"log_level": "debug",
"log_file_path": "/test/path/gollama.log",
"sort_order": "name",
"strip_string": "strip",
"editor": "nano",
"docker_container": "testcontainer"
}
Looks good! Nice work Jose, really appreciate your efforts on this ❤️
Trying to help with:
34
18
11
I am not a senior golang developer, similar to you, I'm a platform/security engineer that wants to learn coding :), so this is my way to learn while contributing to interesting projects.
For #18, we seem to need a bit more work to be able to increase test coverage, such as: