Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
0ccca3515f9b443dea7eb9e9576483556d98f579
[simgrid.git] / src / xbt / xbt_log_appender_file.c
1 /* $Id$ */
2
3 /* file_appender - a dumb log appender which simply prints to stdout        */
4
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
6
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. */
9
10 #include "xbt/sysdep.h"
11 #include "xbt/log.h"
12 #include <stdio.h>
13
14 /**
15  * The root category's default logging function.
16  */
17
18 extern const char *xbt_log_priority_names[7];
19
20
21 static void append_file(xbt_log_appender_t this_appender,
22                         char *str) {
23
24   fprintf((FILE*)(this_appender->data), str);
25 }
26
27 xbt_log_appender_t xbt_log_appender_file_new(xbt_log_layout_t lout){
28   xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t,1);
29   res->layout = lout;
30   res->do_append = append_file;
31   res->free_ = NULL;
32   res->data = (void*)stderr;
33   return res;
34 }