Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
32505bc to
fafab6e
Compare
|
Ok, went ahead to exclude all reviewed pull requests in the scripted-diff. All remaining conflicts don't have any current review, or are waiting to have their reviews addressed in a push anyway. Edit: Also pushed a fix to remove the last embedded newlines. Can be tested with something like: diff --git a/src/logging.cpp b/src/logging.cpp
index f5d184ba33..b2b68ba0c3 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -343,2 +343,3 @@ namespace BCLog {
uint8_t ch = (uint8_t)ch_in;
+ Assert(ch!='\n');
if (ch >= 32 && ch != '\x7f') { |
fa885f4 to
fa0c4cf
Compare
jeanpablojp
left a comment
There was a problem hiding this comment.
Concept ACK
nit: One log format string still has embedded newlines after the CommitTransaction fix, the LogWarning("\n\n************************\n%s", message) in PrintExceptionContinue, which predates this PR.
In feature_init.py it comes out in debug.log as \x0a\x0a************************\x0aEXCEPTION: ....
fa3a813 to
fa78dbf
Compare
Thx, added a fix for that as well. Can be tested via: diff --git a/src/init.cpp b/src/init.cpp
index 8a7b6d15a2..a592bc76a4 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1544,2 +1544,4 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
+//throw int{};
+throw std::runtime_error{"hi"};
and then: Before: After: |
fa78dbf to
fa68d5f
Compare
|
Concept ACK |
The replacement skips log messages that contain: " or \
This keeps the script simple and allows to handle the special cases
manually.
-BEGIN VERIFY SCRIPT-
sed --in-place --regexp-extended 's/(Log(Debug|Error|Info|Trace|Warning)\([^"]*"[^"\\]*)\\n"([,)])/\1"\3/g' $(
git grep -l --extended-regexp 'Log(Debug|Error|Info|Trace|Warning)\(' -- \
'./src' \
':(exclude)src/init.cpp' \
':(exclude)src/net.cpp' \
':(exclude)src/net_processing.cpp' \
':(exclude)src/blockencodings.cpp' \
':(exclude)src/netbase.cpp'
# Some active files in other PRs are excluded due to code-conflicts
)
-END VERIFY SCRIPT-
The stringify function is only used for debugging and all the newline characters are turned into \x0a escapes. This is fine, but it would be better to just avoid the newlines in the first place and use a single line.
This ends up in the debug log, which can not deal with newlines.
The prior function had a lot of issues: * On Windows it printed the exe file name, which is of questionable benefit, when other context is more precise. * On non-Windows it printed "bitcoin" as the file name, which doesn't seem to be helpful either. * The function accepted a thread_name param, which is not accurate, because most call sites passed a function name. * Finally, the function formatted the log with newlines, which will be translated into escapes, like: `\x0a\x0a************************\x0aEXCEPTION: ...` Fix all issues, by: * Dropping the exe file name and instead formatting the source location and optional caller-provided context. * Dropping the redundantly passed function names from callers, now that the source location is used. * Fetching the thread name from the internal getter instead of manually passing it each time. * Formatting it as a single line, to avoid escaped newlines in "normal" exception output.
fa68d5f to
fabb68d
Compare

The log functions sometimes have a trailing newline character. This is perfectly fine, because that char will be stripped again by the log framework. However, it is still confusing:
So remove them, and also fix a few places to remove embedded newlines.