3 @brief file output for Flog
4 @author Nabeel Sowan (nabeel.sowan@vibes.se)
6 When you want flog to write to a file
7 Choose logfile name by setting data to string
10 #include "flog_file.h"
14 int flog_output_file(FLOG_T
*log
,const FLOG_MSG_T
*msg
)
18 if((str
=flog_msg_t_to_str(msg
))==NULL
)
20 if(log
->output_func_data
==NULL
) {
22 flog_print(log
->error_log
,FLOG_ERROR
,"flog_file_output","please set log output filename");
26 if((f
= fopen(log
->output_func_data
,"a+t"))==NULL
) {
28 flog_printf(log
->error_log
,FLOG_ERROR
,NULL
,"cannot open file: %s",log
->output_func_data
);
31 if(fprintf(f
,str
)<0) {
33 flog_printf(log
->error_log
,FLOG_ERROR
,"fprintf","cannot write to file: %s",log
->output_func_data
);
38 flog_printf(log
->error_log
,FLOG_ERROR
,"fflush","cannot write to file: %s",log
->output_func_data
);