- #ifndef TLog_H
- #define TLog_H
- #include <string.h> //strlen();strcpy();strcmp();
- #include <stdio.h> //fseek();fread();fopen();fwrite();fputs();
- #include <time.h> //time();strftime();localtime();
-
- #define SUCCES 1
- #define ERROR 0
- #define SZ_INFINITE 0 //infinite size file.
- #define SZ_DEFAULT 1024 //default size file 1Ko.
- #define SZ_DEFAULT_MSG 255 //default size of log's msg.
- #define TF_DEFAULT "%d/%m/%Y %H:%M:%S>" //Default time format string.
- #define DEFAULT_HEADER \
- "****************************************************************\r\n\
- * Log File Header *\r\n\
- ****************************************************************\r"
-
- typedef unsigned long ULONG;
-
- class TLog
- {
- private:
- FILE * F;
- char * pFileName;
- char * pHeader;
- char * pTimeFormat;
- ULONG ulMaxSize;
- ULONG FileSize;
- ULONG LogCount;
- ULONG LogSize;
- time_t td;
- int RewindPtrLog();
-
- public:
- TLog(const char* const FileName,
- ULONG MaxSize,
- const char* const Header,
- const char * const TimeFormat);
- int NewLog(const char* const Msg,
- bool timer = true);
- int ReadLogN(ULONG n,
- char * Msg);
- int SlimLog();
- int DelLogs();
- int CmpHeader();
- ULONG SizeLog();
- ULONG CountLog();
- ULONG SizeFile();
- ~TLog();
- };
- #endif
#ifndef TLog_H
#define TLog_H
#include <string.h> //strlen();strcpy();strcmp();
#include <stdio.h> //fseek();fread();fopen();fwrite();fputs();
#include <time.h> //time();strftime();localtime();
#define SUCCES 1
#define ERROR 0
#define SZ_INFINITE 0 //infinite size file.
#define SZ_DEFAULT 1024 //default size file 1Ko.
#define SZ_DEFAULT_MSG 255 //default size of log's msg.
#define TF_DEFAULT "%d/%m/%Y %H:%M:%S>" //Default time format string.
#define DEFAULT_HEADER \
"****************************************************************\r\n\
* Log File Header *\r\n\
****************************************************************\r"
typedef unsigned long ULONG;
class TLog
{
private:
FILE * F;
char * pFileName;
char * pHeader;
char * pTimeFormat;
ULONG ulMaxSize;
ULONG FileSize;
ULONG LogCount;
ULONG LogSize;
time_t td;
int RewindPtrLog();
public:
TLog(const char* const FileName,
ULONG MaxSize,
const char* const Header,
const char * const TimeFormat);
int NewLog(const char* const Msg,
bool timer = true);
int ReadLogN(ULONG n,
char * Msg);
int SlimLog();
int DelLogs();
int CmpHeader();
ULONG SizeLog();
ULONG CountLog();
ULONG SizeFile();
~TLog();
};
#endif