openwall / openwall/john

Add a log_print() function

Open
#3,511 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance/cleanup
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Something like:

    log_print(int verbosity, bool main_only, char *format, ...)

Goals: Any code that now prints to stderr and/or log with a bunch of conditions (with 3-10 lines of code each time) could be replaced with a single call to a shared function in logger.c with following options:

  • Send to screen, or log, or both.
  • Line-wrap at word boundary (at whatever we deem to be the output width).
  • Only print to parent process, or any/all. Only print node number when applicable.
  • Optionally colorize serious notes (eg. yellow) and warnings (eg. red).
  • Minimum verbosity for sending to screen and a separate minimum "log level" for sending to log. BTW I think I want specific future options like --log-no-rule-details and --log-no-mode-details while --log-none would deprecate the current -nolog. Perhaps this should be considered.

I have initial code for this, but it really needs some thought to end up really good.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing logger.c and the existing code that prints to stderr and/or the log with conditional logic. Compare those call sites with the proposed verbosity, output-target, wrapping, process, node, color, and log-level options; done means the shared interface and its scope are settled and the relevant call sites can use it consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.