-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: Adding log parts #3019
base: develop
Are you sure you want to change the base?
feat: Adding log parts #3019
Conversation
…dudes/table-layout
…feature/dudes/table-layout" This reverts commit 8f74cfa.
…nto feature/dudes/table-layout
@@ -48,7 +48,7 @@ class TableLayout | |||
/** | |||
* @brief Enumeration for table sections. | |||
*/ | |||
enum Section { header, values }; | |||
enum LogPart { header, values }; |
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.
I don't think you really would like to rename this enum (at least, not to LogPart).
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.
revet
/** | ||
* @brief Draw the first part of the section. It include the title and optionnaly, the description(s); | ||
* @param os An output stream (by default, std::cout) | ||
*/ | ||
void begin( std::ostream & os = std::cout ); | ||
|
||
/** | ||
* @brief Draw the last part of the section. It include the title | ||
* @param oss An output stream (by default, std::cout) | ||
*/ | ||
void end( std::ostream & oss = std::cout ) const; |
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.
Here, we seem to be able to begin()
on multiple output targets. So, to ensure that the content is the same everywhere, I would expect begin()
to be const, and internal values like m_sectionWidth
to be computed when assessors like addDescription()
are used.
Side note: addEndDescription() has no effect on m_sectionWidth
, is it the desired behavior?
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.
after addDescription()
we call void formatAndInsertDescriptions()
where we check m_sectionWidth
void begin( std::ostream & os = std::cout ); | ||
|
||
/** | ||
* @brief Draw the last part of the section. It include the title |
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.
* @brief Draw the last part of the section. It include the title | |
* @brief Draw the last part of the section. It include the title and optionnaly, the end description(s). |
* @brief Set the minimal width of a row | ||
* @param minWidth The minimal width of the table | ||
*/ | ||
void setMinWidth( integer const & minWidth ); |
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.
a good feature in the future would be to have a setMaxWidth()
with line wrapping, to ensure that a section cannot be too large.
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.
I could do this in another PR
/// description border margin | ||
static constexpr integer m_marginBorder = 2; | ||
/// numbers of character used as border | ||
static constexpr integer m_nbBorderChar = 2; |
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.
Please add the #
character as a centralized constant here.
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.
y
m_sectionTitle( string( sectionTitle ) ), | ||
m_sectionWidth( sectionTitle.length() ) | ||
{ | ||
m_footerTitle = GEOS_FMT( "End : {}", m_sectionTitle ); |
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.
- If I was you, I would add a
updateLayout()
private method that takes in parameter every text size like this one, the description lines, them_sectionTitle
, and updatem_rowMinWidth
whenever a larger size is found. I would prevent any side case to produce oversized lines. - please use the term
part
as a prefix for your variables (if you really need one),section
is now irrelevant. - What do you think of replacing
"End : {}"
by"End of {}"
string_view name, | ||
std::vector< string > const & values ) | ||
{ | ||
string const nameFormatted = GEOS_FMT( "- {}: ", string( name )); |
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.
I think that it is the responsability of the class user to add those "- "
at the start of their texts (imagine if you only have one description).
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.
if we have one description we will not have the "- "
, it's only for mutiple values in the description
@@ -170,8 +170,9 @@ bool EventManager::run( DomainPartition & domain ) | |||
m_dt = dt_global; | |||
#endif | |||
} | |||
|
|||
outputTime(); | |||
LogPart logPart( "TIMESTEP START" ); |
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.
I would name this part "TIMESTEP"
or "Timestep no. {}"
. It is strange to see "End : TIMESTEP START"
at its end.
Can you share a full log generated after this PR? |
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.
just check what happened with schema/docs changes
This PR aim to improve the readibility of the logs by adding log separation the differents parts of the log and
the first step for displaying specific log or timestep we want.
The log separation identified are
ProblemManager::postInputInitializationRecursive()
;ProblemManager::generateMesh()
;ProblemManager::applyNumericalMethods()
;ProblemManager::egisterDataOnMeshRecursive()
;ProblemManager::initialize()
;EventManager::run()
basicCleanup()
Example of an input :