3 /* file_appender - a dumb log appender which simply prints to stdout */
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "xbt/sysdep.h"
11 #include "xbt/log_private.h"
15 * The root category's default logging function.
18 extern const char *xbt_log_priority_names[7];
21 static void append_file(xbt_log_appender_t this_appender, char *str) {
22 fprintf((FILE*)(this_appender->data), "%s", str);
25 static void free_ (xbt_log_appender_t this_) {
26 if (this_->data != stderr)
32 xbt_log_appender_t xbt_log_appender_file_new(char *arg){
33 xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t,1);
34 res->do_append = append_file;
37 res->data = (void*)fopen(arg, "w");
39 res->data = (void*)stderr;