-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added a name only constructor to ComLogger #1983
Added a name only constructor to ComLogger #1983
Conversation
@@ -52,11 +52,23 @@ | |||
// match to an expected size on the ground during post processing. | |||
ComLogger(const char* compName, const char* filePrefix, U32 maxFileSize, bool storeBufferLength=true); | |||
|
|||
// CONSTRUCTOR: | |||
ComLogger(const char* compName); |
Check warning
Code scanning / CppCheck
Single-parameter constructors should be marked explicit.
void ComLogger :: | ||
init_log_file(const char* incomingFilePrefix, U32 maxFileSize, bool storeBufferLength) | ||
{ | ||
this->maxFileSize = maxFileSize; |
Check warning
Code scanning / CodeQL
Unchecked function argument
init_log_file(const char* incomingFilePrefix, U32 maxFileSize, bool storeBufferLength) | ||
{ | ||
this->maxFileSize = maxFileSize; | ||
this->storeBufferLength = storeBufferLength; |
Check warning
Code scanning / CodeQL
Unchecked function argument
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.
Minor comments, but looks correct!
@@ -49,6 +67,25 @@ | |||
ComLoggerComponentBase::init(queueDepth, instance); | |||
} | |||
|
|||
void ComLogger :: | |||
init_log_file(const char* incomingFilePrefix, U32 maxFileSize, bool storeBufferLength) |
Check notice
Code scanning / CodeQL
Use of basic integral type
@@ -49,6 +67,25 @@ | |||
ComLoggerComponentBase::init(queueDepth, instance); | |||
} | |||
|
|||
void ComLogger :: | |||
init_log_file(const char* incomingFilePrefix, U32 maxFileSize, bool storeBufferLength) |
Check notice
Code scanning / CodeQL
Use of basic integral type
@kubiak-jpl this looks good. I did three things:
If you are ok with this, we can merge! |
} | ||
FW_ASSERT(Fw::StringUtils::string_length(incomingFilePrefix, sizeof(this->filePrefix)) < sizeof(this->filePrefix), | ||
Fw::StringUtils::string_length(incomingFilePrefix, sizeof(this->filePrefix)), sizeof(this->filePrefix)); // ensure that file prefix is not too big | ||
this->init_log_file(incomingFilePrefix, maxFileSize, storeBufferLength); |
Check warning
Code scanning / CodeQL
Unchecked function argument
} | ||
FW_ASSERT(Fw::StringUtils::string_length(incomingFilePrefix, sizeof(this->filePrefix)) < sizeof(this->filePrefix), | ||
Fw::StringUtils::string_length(incomingFilePrefix, sizeof(this->filePrefix)), sizeof(this->filePrefix)); // ensure that file prefix is not too big | ||
this->init_log_file(incomingFilePrefix, maxFileSize, storeBufferLength); |
Check warning
Code scanning / CodeQL
Unchecked function argument
} | ||
FW_ASSERT(Fw::StringUtils::string_length(incomingFilePrefix, sizeof(this->filePrefix)) < sizeof(this->filePrefix), | ||
Fw::StringUtils::string_length(incomingFilePrefix, sizeof(this->filePrefix)), sizeof(this->filePrefix)); // ensure that file prefix is not too big | ||
this->init_log_file(incomingFilePrefix, maxFileSize, storeBufferLength); |
Check warning
Code scanning / CodeQL
Unchecked function argument
Looks good to me |
@kubiak-jpl merged! |
* Added a name only constructor to ComLogger * Minor fixup of CodeQL warnings * Fixing ctor warnings, checking arg * Reusing init_log_file in constructor * sp * NULL -> nullptr * Adding throttle --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
* Added a name only constructor to ComLogger * Minor fixup of CodeQL warnings * Fixing ctor warnings, checking arg * Reusing init_log_file in constructor * sp * NULL -> nullptr * Adding throttle --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
Change Description
Updated ComLogger to include a name-only constructor and an additional initialization method
Added a new internal state to keep track of initialization. The ComLogger file will not open if
init_log_file
is not called and a WARNING_LO event will be created. Using the old constructor sets this state to initialized by defaultAdded unit tests to cover the new constructor.
Rationale
The name-only constructor is necessary to use ComLogger without the need for phases in the topology fpp.
Testing/Review Recommendations
Updated unit tests
Future Work
None