A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ruby Msg Binding : new Methods and new Example
[simgrid.git]
/
src
/
xbt
/
xbt_log_appender_file.c
diff --git
a/src/xbt/xbt_log_appender_file.c
b/src/xbt/xbt_log_appender_file.c
index
c63b724
..
28c9b56
100644
(file)
--- a/
src/xbt/xbt_log_appender_file.c
+++ b/
src/xbt/xbt_log_appender_file.c
@@
-8,26
+8,37
@@
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/sysdep.h"
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/sysdep.h"
-#include "xbt/log.h"
+#include "xbt/log
_private
.h"
#include <stdio.h>
/**
* The root category's default logging function.
*/
#include <stdio.h>
/**
* The root category's default logging function.
*/
-extern const char *xbt_log_priority_names[
7
];
+extern const char *xbt_log_priority_names[
8
];
-static void append_file(xbt_log_appender_t this_appender,
- char *str) {
+static void append_file(xbt_log_appender_t this_appender, char *str)
+{
+ fprintf((FILE *) (this_appender->data), "%s", str);
+}
- fprintf((FILE*)(this_appender->data), str);
+static void free_(xbt_log_appender_t this_)
+{
+ if (this_->data != stderr)
+ fclose(this_->data);
}
}
-xbt_log_appender_t xbt_log_appender_file_new(char *arg){
- xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t,1);
+
+
+xbt_log_appender_t xbt_log_appender_file_new(char *arg)
+{
+ xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t, 1);
res->do_append = append_file;
res->do_append = append_file;
- res->free_ = NULL;
- res->data = (void*)stderr;
+ res->free_ = free_;
+ if (arg)
+ res->data = (void *) fopen(arg, "w");
+ else
+ res->data = (void *) stderr;
return res;
}
return res;
}