2013-02-01 03:15:48 +01:00
|
|
|
/* radare - LGPL - Copyright 2007-2013 - pancake */
|
2010-03-12 18:46:11 +01:00
|
|
|
|
2010-07-12 00:50:00 +02:00
|
|
|
#include <r_util.h>
|
|
|
|
|
2011-11-16 10:06:34 +01:00
|
|
|
// XXX: This api is kinda ugly.. we need to redefine it
|
|
|
|
|
2010-07-12 00:50:00 +02:00
|
|
|
static const char *logfile = "radare.log";
|
|
|
|
|
|
|
|
R_API void r_log_file(const char *str) {
|
2012-10-20 00:31:18 +02:00
|
|
|
FILE *fd = r_sandbox_fopen (logfile, "a+");
|
2010-07-12 00:50:00 +02:00
|
|
|
if (fd) {
|
|
|
|
fputs (str, fd);
|
|
|
|
fclose (fd);
|
|
|
|
} else eprintf ("ERR: Cannot open %s\n", logfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
R_API void r_log_msg(const char *str) {
|
2010-03-12 18:46:11 +01:00
|
|
|
fputs ("LOG: ", stderr);
|
|
|
|
fputs (str, stderr);
|
2010-07-12 00:50:00 +02:00
|
|
|
r_log_file (str);
|
2010-02-05 12:21:37 +01:00
|
|
|
}
|
|
|
|
|
2010-07-12 00:50:00 +02:00
|
|
|
R_API void r_log_error(const char *str) {
|
2010-03-12 18:46:11 +01:00
|
|
|
fputs ("ERR: ", stderr);
|
|
|
|
fputs (str, stderr);
|
2015-12-08 13:24:21 +01:00
|
|
|
r_log_file (str);
|
2010-02-05 12:21:37 +01:00
|
|
|
}
|
|
|
|
|
2010-07-12 00:50:00 +02:00
|
|
|
R_API void r_log_progress(const char *str, int percent) {
|
|
|
|
printf ("%d%%: %s\n", percent, str);
|
2010-02-05 12:21:37 +01:00
|
|
|
}
|