#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#define TRUE 1
#define FALSE 0
#define SUCCESS 0
#define FAILURE -1
#define MAXFILESIZE 1024
using namespace std;
class Log
{
private:
string File; /*File stores the file name*/
FILE *Fp; /*File pointer to the log file*/
int FileSize; /*Size of the File Size*/
int enable_rotation_flag; /*If this flag is set, logs are rotated*/
int enable_filesplit_flag; /*If this flag is set, new log files are created
with same name as File and logged*/
int NthFile; /*This is used if file-split is enabled*/
public:
Log(); /*Default constructor*/
Log(char *file); /*specify the log file*/
Log(char *file, int filesize); /*specify the log file with max size for the log file*/
~Log(); /*Destructor*/
int GetLogSize(); /*get the log file size*/
int SetLogSize(int sz); /*set the log file size*/
int LogOpen();/*open the log file*/
int LogOpen(char *file); /*opens the specified log file*/
int LogOpen(string file); /*opens the specified log file*/
int LogWrite(const char *fmt, ...); /*writes the log message to the file*/
int LogCritical(const char *fmt, ...); /*write the log message(critical) to
the file as well as console, as its critical*/
int LogRotateEnable(void); /*Enable log rotation*/
int LogRotateDisable(void); /*Disable log rotation*/
int LogSplitEnable(void); /*Split the log files if log file size exceeds default*/
int LogSplitDisable(void); /*disable the split of log files*/
int LogClose();/*close the log file*/
};