Skip to content

Commit

Permalink
Merge pull request #6166 from mikesinouye/logger
Browse files Browse the repository at this point in the history
Format max message reached log messages.
  • Loading branch information
maliberty authored Nov 20, 2024
2 parents a282396 + f54146a commit b48f949
Show file tree
Hide file tree
Showing 6 changed files with 1,017 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/rsz/test/clone_flat.ok
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ worst slack -0.16
[WARNING RSZ-0075] makeBufferedNet failed for driver clone3/ZN
840 | 0 | -14 | 5 | 12 | 2 | -0.163 | -20.9 | 150 | load114/D
[WARNING RSZ-0075] makeBufferedNet failed for driver drvr_2/Q
[WARNING RSZ-0075] message limit reached, this message will no longer print
[WARNING RSZ-0075] message limit (1000) reached. This message will no longer print.
842 | 0 | -15 | 4 | 9 | 2 | -0.148 | -21.3 | 150 | load131/D
849 | 0 | -16 | 4 | 9 | 2 | -0.148 | -21.3 | 150 | load131/D
850 | 0 | -16 | 4 | 9 | 2 | -0.148 | -21.3 | 150 | load131/D
Expand Down
9 changes: 5 additions & 4 deletions src/utl/include/utl/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,13 @@ class Logger

if (count == max_message_print) {
logger_->log(level,
"[{} {}-{:04d}] message limit reached, "
"this message will no longer print"
+ std::string(spdlog::details::os::default_eol),
"[{} {}-{:04d}] message limit ({})"
" reached. This message will no longer print.{}",
level_names[level],
tool_names_[tool],
id);
id,
max_message_print,
spdlog::details::os::default_eol);
} else {
counter--; // to avoid counter overflow
}
Expand Down
7 changes: 6 additions & 1 deletion src/utl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
include("openroad")

set(TEST_NAMES
test_info
test_info
test_error
test_suppress_message
test_metrics
logger_max_messages
logger_redirection
logger_redirection_nonewline
tee
tee_fails
)

foreach(TEST_NAME IN LISTS TEST_NAMES)
Expand Down
Loading

2 comments on commit b48f949

@stefanottili
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, why 1000 ?
I would argue that 10 is a more reasonable number, everything above that just doesn't add any more information.

@maliberty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit arbitrary. Sometimes it is useful to have a sense of magnitude (10 warnings vs 100 vs 1000+).

Please sign in to comment.