changed text output format
[flog.git] / flog_stdio.c
blob14240ef82f2d83912757fcbeabad3653e478d417
1 /*!
2 @file flog_stdio.c
3 @brief stdio output for Flog
4 @author Nabeel Sowan (nabeel.sowan@vibes.se)
6 When you want flog to write to a stdout or stderr
7 */
9 #include "flog_stdio.h"
10 #include <stdlib.h>
11 #include <stdio.h>
13 int flog_output_stdout(FLOG_T *log __attribute__((__unused__)),const FLOG_MSG_T *msg)
15 char *str;
16 if((str=flog_msg_t_to_str(msg))==NULL)
17 return(1);
18 if(fprintf(stdout,str)<0) {
19 free(str);
20 return(1);
22 free(str);
23 return(0);
26 int flog_output_stderr(FLOG_T *log __attribute__((__unused__)),const FLOG_MSG_T *msg)
28 char *str;
29 if((str=flog_msg_t_to_str(msg))==NULL)
30 return(1);
31 if(fprintf(stderr,str)<0) {
32 free(str);
33 return(1);
35 free(str);
36 return(0);