aboutsummaryrefslogtreecommitdiff
path: root/src/libparsec/include/utl_logfile.h
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2026-08-24 11:16:07 +0200
committerFelix Morgner <felix.morgner@gmail.com>2026-08-24 11:16:07 +0200
commitc068f22329d5cc722622a2183bbb22eef2093df7 (patch)
tree12d56c1aede67988a55e241364606bfbb4dba933 /src/libparsec/include/utl_logfile.h
downloadopenparsec-c068f22329d5cc722622a2183bbb22eef2093df7.tar.xz
openparsec-c068f22329d5cc722622a2183bbb22eef2093df7.zip
initial importHEADmain
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_