From b6541dc11b605d8eb08fb6f9a5a484a935415455 Mon Sep 17 00:00:00 2001 From: Nabeel Sowan Date: Thu, 11 Dec 2008 16:32:01 +0100 Subject: [PATCH] add (incomplete) file output support --- flog_file.c | 29 +++++++++++++++++++++++++++++ flog_file.h | 16 ++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 flog_file.c create mode 100644 flog_file.h diff --git a/flog_file.c b/flog_file.c new file mode 100644 index 0000000..aa88f67 --- /dev/null +++ b/flog_file.c @@ -0,0 +1,29 @@ +/*! + @file flog_file.c + @brief file output for Flog + @author Nabeel Sowan (nabeel.sowan@vibes.se) + + When you want flog to write to a file +*/ + +#include "flog_file.h" +#include + +int flog_output_file(const FLOG_MSG_T *p,void *data) +{ + char *str; + if((str=flog_msg_t_to_str(p))==NULL) + return(1); + + FILE *f; + if((f = fopen("logfile","a+t"))==NULL) //! @todo implement this + return(1); + if(fprintf(f,str)<0) { + free(str); + return(1); + } + fclose(f); + + free(str); + return(0); +} diff --git a/flog_file.h b/flog_file.h new file mode 100644 index 0000000..7a652d0 --- /dev/null +++ b/flog_file.h @@ -0,0 +1,16 @@ +/*! + @file flog_file.h + @brief file output for Flog + @author Nabeel Sowan (nabeel.sowan@vibes.se) + + When you want flog to write to a file +*/ + +#ifndef FLOG_FILE_H +#define FLOG_FILE_H + +#include + +int flog_output_file(const FLOG_MSG_T *p,void *data); + +#endif -- 2.11.4.GIT