From c068f22329d5cc722622a2183bbb22eef2093df7 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 24 Aug 2026 11:16:07 +0200 Subject: initial import --- src/libparsec/include/utl_logfile.h | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/libparsec/include/utl_logfile.h (limited to 'src/libparsec/include/utl_logfile.h') 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_ -- cgit v1.2.3