Skip to content

Conversation

@magnumripper
Copy link
Member

Adds color to many warning/errors. This includes shared stuff such as BENCH_CLERROR and error() so we get more visibility to many problems.

Adds shared macros LOG_ONCE, WARN_ONCE and WARN_LOG_ONCE.

Drops obsolete dead code.

@magnumripper
Copy link
Member Author

I wasn't quite sure where to place WARN_ONCE macro. I put it in misc.h.

@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch from adc9dc5 to de6d9d7 Compare November 17, 2025 07:25
@magnumripper
Copy link
Member Author

I will revert the log_event vs. log_event_ex thing. Since the callers are changed anyway when switching to the macro, the newline should just be dropped there instead.

@magnumripper magnumripper marked this pull request as draft November 17, 2025 07:35
@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch from de6d9d7 to 04546d1 Compare November 17, 2025 21:05
@magnumripper
Copy link
Member Author

I will revert the log_event vs. log_event_ex thing. Since the callers are changed anyway when switching to the macro, the newline should just be dropped there instead.

Did so now, and putc the newline to stream after the fprintf_color of the message.

Also added much more (modes, formats). This PR can stay draft for a while, I'll add more of the same.

@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch 6 times, most recently from 4b0a926 to f0a5684 Compare November 17, 2025 23:50
@magnumripper magnumripper removed the request for review from solardiz November 18, 2025 00:48
@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch 3 times, most recently from 08cdb1f to 908a43a Compare November 18, 2025 22:04
@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch 2 times, most recently from 68d423c to cfc5efc Compare November 27, 2025 16:14
@magnumripper magnumripper marked this pull request as ready for review November 27, 2025 16:18
@magnumripper
Copy link
Member Author

I am sure I missed things that would really benefit from color, we'll just have to add them later.

@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch 6 times, most recently from 7246737 to ce48b18 Compare November 27, 2025 19:31
@magnumripper
Copy link
Member Author

@solardiz this is a pain to review but at least "core files", modes, shared OpenCL and formats are different commits and best reviewed one by one.

Also, I'm not only sure you will request some changes right away but also that we'll both end up wanting to change other things later. It's more or less impossible to test all this by just running john - some notes/warnings doesn't pop up too often.

I used color_notice for many messages starting with "Note:" and color_warning for nearly all starting with "Warning:" but there were a few "obvious" exceptions and we'll probably find out more over time.

Add some function-like macros for log/warn/both

WARN_AND_LOG() is like fprintf_color() then log_event(), with same message.

WARN_ONCE() is like fprintf_color() but only once per session.
LOG_ONCE() is like log_event() but only once per session.
WARN_AND_LOG_ONCE() does both, with same message.

Also add error color to error(), pexit() and similar stuff in misc.c
@magnumripper magnumripper force-pushed the warning-and-log-tweaks branch from ce48b18 to 9e5584d Compare November 28, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant