-
Notifications
You must be signed in to change notification settings - Fork 41
Allow logging outside of setting the logging callback #106
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
Conversation
deschuma
commented
May 19, 2020
- Addresses Issue Enable logging if environment variable set #102 to enable logging to stdout independent of OE SDK
- Implements OE SDK ask to enable testing without on-demand registration, if desired
- Moves the environment variable functionality into a header file
…itly set AZDCAP logging to stdout
…, and cleanup logging
… a message indicating debug logging is enabled; Prefer logging callback over printf if it is set
src/environment.h
Outdated
| return std::string(); | ||
| } | ||
|
|
||
| auto retval = std::string(env_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why save to a local variable here before returning? Why not just return std::string(env_value);?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks fixed
letmaik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| return std::string(); | ||
| } | ||
| #endif | ||
| else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else [](start = 4, length = 4)
This 'else' is unnecessary. Both 'if' statements exit the function. Visually, it seems odd to share 'else' block by 2 'if' blocks.
| { | ||
| log(SGX_QL_LOG_ERROR, | ||
| "Value specified in environment variable %s is either empty or " | ||
| "expected max length '%d'.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%d [](start = 38, length = 2)
Missing an integer param for the %d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks fixed
|
The logging for parameters passed in sgx_ql_get_quote_config() is only on when the target was Not found in the cache. Could you take this chance to enable logging when cache was hit as well? |
src/logging.cpp
Outdated
| using namespace std; | ||
|
|
||
| sgx_ql_logging_function_t logger_callback = nullptr; | ||
| static sgx_ql_log_level_t debug_log_level; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug_log_level [](start = 26, length = 15)
Initialize it. #Closed
src/logging.cpp
Outdated
| if (logger_callback != nullptr) | ||
| { | ||
| logger_callback(level, message); | ||
| }else if (enable_debug_log) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linefeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks - fixed
src/logging.cpp
Outdated
|
|
||
| sgx_ql_logging_function_t logger_callback = nullptr; | ||
| static sgx_ql_log_level_t debug_log_level; | ||
| bool enable_debug_log = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable_debug_log [](start = 5, length = 16)
Minor suggestion - enable_debug_log is always coupled with debug_log_level. You can define something like "SGX_QL_LOG_NONE" to replace enable_debug_log being false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks - fixed
|
@soccerGB logging for parameters happens regardless of caching or not - is there a specific parameter I am missing? |