mirror of
https://github.com/reactos/ccache.git
synced 2024-12-02 16:46:24 +00:00
Add cc_log_without_flush
This commit is contained in:
parent
72206bb1df
commit
37ca1a0cf1
2
ccache.h
2
ccache.h
@ -99,7 +99,9 @@ bool hash_file(struct mdfour *md, const char *fname);
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* util.c */
|
||||
|
||||
void cc_vlog(const char *format, va_list ap);
|
||||
void cc_log(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
|
||||
void cc_log_without_flush(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
|
||||
void cc_log_argv(const char *prefix, char **argv);
|
||||
void fatal(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
|
||||
void copy_fd(int fd_in, int fd_out);
|
||||
|
36
util.c
36
util.c
@ -98,23 +98,45 @@ path_max(const char *path)
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a message to the CCACHE_LOGFILE location (adding a newline).
|
||||
* Write a message to the log file (adding a newline) and flush.
|
||||
*/
|
||||
void
|
||||
cc_log(const char *format, ...)
|
||||
cc_vlog(const char *format, va_list ap)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (!init_log()) {
|
||||
return;
|
||||
}
|
||||
|
||||
log_prefix();
|
||||
va_start(ap, format);
|
||||
vfprintf(logfile, format, ap);
|
||||
va_end(ap);
|
||||
fprintf(logfile, "\n");
|
||||
fflush(logfile);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a message to the log file (adding a newline) and flush.
|
||||
*/
|
||||
void
|
||||
cc_log(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
cc_vlog(format, ap);
|
||||
va_end(ap);
|
||||
if (logfile) {
|
||||
fflush(logfile);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a message to the log file (adding a newline).
|
||||
*/
|
||||
void
|
||||
cc_log_without_flush(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
cc_vlog(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user