refactor: standardize error reporting on the log module

- Add log_perror() helper (context + strerror(errno)) to the log module
- Replace all bare perror() calls with log_perror() so errors are routed
  through the unified logger (stderr sink + optional --log-file sink)
- Convert fprintf(stderr, "Error:/Warning: ...") in client code to
  log_message(); raw fprintf kept only for progress/stats output
This commit is contained in:
2026-08-30 14:06:48 +02:00
parent ae95211a05
commit 6d82967c68
16 changed files with 86 additions and 73 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int
int fd = open(file->path, O_RDONLY);
if (fd == -1) {
perror("Could not open file for sendfile");
log_perror("Could not open file for sendfile");
return false;
}
@@ -121,7 +121,7 @@ bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int
if (sent == -1) {
if (errno == EAGAIN || errno == EINTR)
continue;
perror("sendfile failed");
log_perror("sendfile failed");
close(fd);
return false;
}