-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement improvement for customizing logging config (#877)
* implement changes * pin sanic-testing to fix failing integration tests, add docstring * re-add mypy ignore * add testing * fix default logging not logging to file * add changelog
- Loading branch information
Showing
15 changed files
with
655 additions
and
134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added CLI option `--logging-config-file` to enable configuration of custom logs formatting. |
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,2 @@ | ||
user: user | ||
password: pass |
20 changes: 20 additions & 0 deletions
20
data/test_logging_config_files/test_invalid_format_value_in_config.yml
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,20 @@ | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
normalFormatter: | ||
# invalid value | ||
format: None | ||
handlers: | ||
test_handler: | ||
level: INFO | ||
formatter: normalFormatter | ||
class: logging.FileHandler | ||
filename: "logging_test.log" | ||
loggers: | ||
root: | ||
handlers: [test_handler] | ||
level: INFO | ||
rasa: | ||
handlers: [test_handler] | ||
level: INFO | ||
propagate: 0 |
21 changes: 21 additions & 0 deletions
21
data/test_logging_config_files/test_invalid_handler_key_in_config.yml
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,21 @@ | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
normalFormatter: | ||
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}" | ||
handlers: | ||
test_handler: | ||
level: INFO | ||
formatter: normalFormatter | ||
class: logging.FileHandler | ||
filename: "logging_test.log" | ||
# invalid unknown key | ||
extra_key: "hello world" | ||
loggers: | ||
root: | ||
handlers: [test_handler] | ||
level: INFO | ||
rasa: | ||
handlers: [test_handler] | ||
level: INFO | ||
propagate: 0 |
20 changes: 20 additions & 0 deletions
20
data/test_logging_config_files/test_invalid_value_for_level_in_config.yml
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,20 @@ | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
normalFormatter: | ||
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}" | ||
handlers: | ||
test_handler: | ||
# invalid value for level | ||
level: HIGH | ||
formatter: normalFormatter | ||
class: logging.FileHandler | ||
filename: "logging_test.log" | ||
loggers: | ||
root: | ||
handlers: [test_handler] | ||
level: INFO | ||
rasa: | ||
handlers: [test_handler] | ||
level: INFO | ||
propagate: 0 |
20 changes: 20 additions & 0 deletions
20
data/test_logging_config_files/test_missing_required_key_invalid_config.yml
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,20 @@ | ||
# missing mandatory key | ||
# version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
normalFormatter: | ||
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}" | ||
handlers: | ||
test_handler: | ||
level: INFO | ||
formatter: normalFormatter | ||
class: logging.FileHandler | ||
filename: "logging_test.log" | ||
loggers: | ||
root: | ||
handlers: [test_handler] | ||
level: INFO | ||
rasa: | ||
handlers: [test_handler] | ||
level: INFO | ||
propagate: 0 |
20 changes: 20 additions & 0 deletions
20
data/test_logging_config_files/test_non_existent_handler_id.yml
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,20 @@ | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
normalFormatter: | ||
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}" | ||
handlers: | ||
test_handler: | ||
level: INFO | ||
formatter: normalFormatter | ||
class: logging.FileHandler | ||
filename: "logging_test.log" | ||
loggers: | ||
root: | ||
# a non-existent handler id | ||
handlers: [some_handler] | ||
level: INFO | ||
rasa: | ||
handlers: [test_handler] | ||
level: INFO | ||
propagate: 0 |
19 changes: 19 additions & 0 deletions
19
data/test_logging_config_files/test_valid_logging_config.yml
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,19 @@ | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
customFormatter: | ||
format: "{\"time\": \"%(asctime)s\", \"name\": \"[%(name)s]\", \"levelname\": \"%(levelname)s\", \"message\": \"%(message)s\"}" | ||
handlers: | ||
test_handler: | ||
level: INFO | ||
formatter: customFormatter | ||
class: logging.FileHandler | ||
filename: "logging_test.log" | ||
loggers: | ||
root: | ||
handlers: [test_handler] | ||
level: INFO | ||
rasa_sdk: | ||
handlers: [test_handler] | ||
level: INFO | ||
propagate: 0 |
Oops, something went wrong.