28 #include <sys/types.h>
30 #include "logexceptions.h"
32 const std::string path =
"./log/";
33 const std::string ext =
".log";
43 error=stat(path.c_str(),&st);
46 if(mkdir(path.c_str(),S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)!=0)
47 throw CLogException(_HERE_,
"Impossible to create log folder",path);
49 this->filename=path + filename + ext;
50 this->log_file.open(this->filename.c_str(),std::ios_base::out);
53 throw CLogException(_HERE_,
"Log file can not be open",this->filename);
80 return this->filename;
97 this->log_file.close();
std::string get_filename(void)
Function to get the full filename.
ctimeformat get_time_format()
Function to get the time format.
void enable(void)
Function to enable the log This function enable the particular log associated with the object...
void set_time_format(ctimeformat format)
Function to set the time format.
ctimeformat getFormat()
Gets output string format.
void disable(void)
Function to disable the log This function disables the particular log associated with the object...
void exit(void)
function to release the critical section
void enter(void)
function to request access to the critical section
CLog(const std::string &filename)
Constructor.
void setFormat(ctimeformat format)
Sets output string format.
bool is_enabled(void)
Function to check if the log is enabled.