-
Notifications
You must be signed in to change notification settings - Fork 112
[CLIENT-2740] Fix bug where LOG_LEVEL_OFF causes more logs to be produced (as if LOG_LEVEL_TRACE was set) #572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+273
−123
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
f0bdf8f
Fixed LOG_LEVEL_OFF to disable logging
DomPeliniAerospike 24aed52
Merge branch 'stage' into CLIENT-2740
DomPeliniAerospike 986bd14
refactor code to preserve original ordering
DomPeliniAerospike bba6577
Update log.h
DomPeliniAerospike 18d31a2
Refactored log.c
DomPeliniAerospike acc5e94
Fixed test bug
DomPeliniAerospike d77f33d
Corrected test for coverage
DomPeliniAerospike ce63d4a
Added coverage for overflow
DomPeliniAerospike ec4dcc6
FF CLIENT-2740 to dev (#866)
DomPeliniAerospike 3ca724b
running PR tests
DomPeliniAerospike a13cabe
Merge remote-tracking branch 'origin/dev' into CLIENT-2740
juliannguyen4 30e5447
fix
juliannguyen4 3512ce3
Clean up example code
juliannguyen4 0081c9b
Add missing documentation for aerospike.set_log_handler and aerospike…
juliannguyen4 5f2999f
Since this is main behavior, move outside of param
juliannguyen4 adf31ae
Fix formatting. Document default behavior of global logging...
juliannguyen4 49aa78e
Improve docs for callback signature
juliannguyen4 64ebad7
Callback can be None
juliannguyen4 25796a9
fix
juliannguyen4 2b536bf
fix
juliannguyen4 635d58f
aerospike.set_log_level() parameter name: Just update docs to match i…
juliannguyen4 0db421c
Rename vars in implementation to be consistent. Match docs with imple…
juliannguyen4 3106b1f
Refactor
juliannguyen4 3a13d25
Refactor LOG_LEVEL_OFF callback logic. Just use a boolean flag to kee…
juliannguyen4 3333fb8
Have debug log printed when client is created
juliannguyen4 6d58eae
Refactor and add more test cases
juliannguyen4 d9a1548
Add kwd tests
juliannguyen4 f8dc1fe
Fix test
juliannguyen4 0baccf3
fix test
juliannguyen4 c21fc8a
capsys doesn't capture printf in c code
juliannguyen4 9aaae03
Don't check for live logs in stdout since test case will fail if pyth…
juliannguyen4 a486518
Rm since capsys doesn't work properly
juliannguyen4 97e0a21
Merge remote-tracking branch 'origin/dev' into CLIENT-2740
juliannguyen4 9407955
Rm this part because it implies log level is set to LOG_LEVEL_OFF whi…
juliannguyen4 95c96c2
Add section for default behavior and reference it in docstring
juliannguyen4 29c166b
Move macro to header for reuse
juliannguyen4 37f24f0
Add more tests for code coverage.
juliannguyen4 81434b9
Add more thorough test case that checks overriding behavior for log l…
juliannguyen4 9933712
Clear up test cases
juliannguyen4 0c6ab6c
just fix syntax
juliannguyen4 e857a3f
Clear up
juliannguyen4 708951c
fix test. clarify why undefined
juliannguyen4 7d1e4d3
just rename to make simpler to read
juliannguyen4 74cc6af
Clear up default behavior
juliannguyen4 853f8b0
Update doc/examples/log.py
juliannguyen4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,34 @@ | ||
| # Enable the logging at application start, before connecting to the server. | ||
| import aerospike | ||
|
|
||
| ## SETTING THE LOG HANDLER ## | ||
|
|
||
| # Clears saved log handler and disable logging | ||
| aerospike.set_log_handler(None) | ||
|
|
||
| # Set default log handler to print to the console | ||
| aerospike.set_log_handler() | ||
|
|
||
| def log_callback(level, func, path, line, msg): | ||
| print("[{}] {}".format(func, msg)) | ||
|
|
||
| # Set log handler to custom callback function (defined above) | ||
| aerospike.set_log_handler(log_callback) | ||
|
|
||
|
|
||
| ## SETTING THE LOG LEVEL ## | ||
|
|
||
| # disables log handling | ||
| aerospike.set_log_level(aerospike.LOG_LEVEL_OFF) | ||
|
|
||
| # Enables log handling and sets level to LOG_LEVEL_TRACE | ||
| aerospike.set_log_level(aerospike.LOG_LEVEL_TRACE) | ||
|
|
||
| # Create a client and connect it to the cluster | ||
| # This line will print use log_callback to print logs with a log level of TRACE | ||
| config = { | ||
| "hosts": [ | ||
| ("127.0.0.1", 3000) | ||
| ] | ||
| } | ||
| client = aerospike.client(config) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.