The src/shared/log.c and src/shared/log.h logging module has no dedicated unit tests. While logging is a straightforward module, there are behaviors worth testing:
set_log_level() filtering works correctly (messages below threshold are suppressed)
log_message() with various log levels
Thread safety of the logging (the module uses no synchronization)
Location
src/shared/log.c, src/shared/log.h
Suggested Fix
Add a simple test that:
Sets log level to ERROR
Verifies that DEBUG/INFO/WARNING messages are suppressed
Sets log level to DEBUG
Verifies all messages are logged
A simple approach is to capture stderr output using freopen() or pipe redirection, or to add a test-only function that checks the current log level.
Severity
Low
Category
Quality
## Description
The `src/shared/log.c` and `src/shared/log.h` logging module has no dedicated unit tests. While logging is a straightforward module, there are behaviors worth testing:
1. `set_log_level()` filtering works correctly (messages below threshold are suppressed)
2. `log_message()` with various log levels
3. Thread safety of the logging (the module uses no synchronization)
## Location
`src/shared/log.c`, `src/shared/log.h`
## Suggested Fix
Add a simple test that:
1. Sets log level to ERROR
2. Verifies that DEBUG/INFO/WARNING messages are suppressed
3. Sets log level to DEBUG
4. Verifies all messages are logged
A simple approach is to capture stderr output using `freopen()` or pipe redirection, or to add a test-only function that checks the current log level.
## Severity
Low
## Category
Quality
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
The
src/shared/log.candsrc/shared/log.hlogging module has no dedicated unit tests. While logging is a straightforward module, there are behaviors worth testing:set_log_level()filtering works correctly (messages below threshold are suppressed)log_message()with various log levelsLocation
src/shared/log.c,src/shared/log.hSuggested Fix
Add a simple test that:
A simple approach is to capture stderr output using
freopen()or pipe redirection, or to add a test-only function that checks the current log level.Severity
Low
Category
Quality