aboutsummaryrefslogtreecommitdiff
path: root/src/libparsec/include/utl_logfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libparsec/include/utl_logfile.h')
-rw-r--r--src/libparsec/include/utl_logfile.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/libparsec/include/utl_logfile.h b/src/libparsec/include/utl_logfile.h
new file mode 100644
index 0000000..ffd44cb
--- /dev/null
+++ b/src/libparsec/include/utl_logfile.h
@@ -0,0 +1,53 @@
+/*
+ * PARSEC HEADER: utl_logfile.h
+ */
+
+#ifndef _UTL_LOGFILE_H_
+#define _UTL_LOGFILE_H_
+
+// max. length of temporary buffer --------------------------------------------
+//
+#define MAX_LOG_BUFFER_LEN 4096
+
+// class for logging information ----------------------------------------------
+//
+class UTL_LogFile
+{
+protected:
+ char m_szBuffer[ MAX_LOG_BUFFER_LEN + 1 ];
+ size_t m_nBufferLen;
+ FILE* m_pFile;
+ refframe_t m_LastFlushRefframe;
+
+protected:
+
+ // add an entry to the logfile
+ void _AddEntry( const char* szEntry, size_t len2 );
+
+public:
+
+ // standard ctor
+ UTL_LogFile( const char* szFilename = NULL );
+
+ // standard dtor
+ ~UTL_LogFile();
+
+ // open the logfile
+ int Open( const char* szFilename );
+
+ // printf like adding to the logfile
+ int printf( const char *format, ... );
+
+ // flush the buffer to the disk file
+ void Flush();
+};
+
+
+// external functions ---------------------------------------------------------
+//
+
+// flush all registerd logfiles
+void UTL_FlushRegisteredLogfiles();
+
+
+#endif // !_UTL_LOGFILE_H_