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