Replace print_warning and print_error utility functions with macros

- Implement `eprintln_warn` and `eprintln_warn` macros.
- Move generalised, utility macros to the utils module.
- Refactor `format_str` to `format_static`.
- Remove re-exports of ansi functions from utils module.
This commit is contained in:
Xavier Moffett 2025-02-09 23:03:42 -05:00
parent f5e5c01697
commit e790ddaaa3
Signed by: Sapphirus
GPG key ID: A6C061B2CEA1A7AC
15 changed files with 101 additions and 95 deletions

View file

@ -28,6 +28,7 @@ use serde::Deserialize;
use pacwrap_core::{
config::Global,
constants::{VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH},
eprintln_warn,
err,
log::{Level, Logger},
sync::{
@ -42,7 +43,7 @@ use pacwrap_core::{
AlpmConfigData,
SyncError,
},
utils::{bytebuffer::ByteBuffer, print_warning},
utils::{ansi::*, bytebuffer::ByteBuffer},
Error,
ErrorGeneric,
Result,
@ -139,7 +140,7 @@ fn conduct_transaction(
if error.kind() != NotFound {
let message = &format!("Failed to propagate ld.so.cache: {}", error);
print_warning(message);
eprintln_warn!("{}", message);
logger.log(Level::Warn, message)?;
}
}