I'm refactoring the logger code in my software.
The old log message ends with either
); or just
; at the end of a line and I want to remove those characters and add a new line with some additional data. Here are a few examples showing the endings:
SNAP_LOG_INFO("Some message"); SNAP_LOG_INFO("Some message ")(variable); SNAP_LOG_INFO("Some message ")(func()); SNAP_LOG_INFO() << "Some message"; // Here is a special case, but I'm not trying to solve it because it's really rare SNAP_LOG_INFO() << func();
I built my macro like this:
\n is the Enter key and
\^[ is the escape key)
That works great when the line ends with ");" but it deletes one too many characters when the old version ends with just ";".
How can I update my macro to make it work in both cases?