37 #elif defined __APPLE__
38 #include <Carbon/Carbon.h>
71 std::cout <<
"Warning: error while opening " <<
84 DIR *
const dir = opendir(
mLogDir.c_str());
93 const std::string &dateStr =
getDir();
94 const std::string logFileName =
strprintf(
95 "%s/#General.log", dateStr.c_str());
110 const std::string &dateStr =
getDir();
111 const std::string logFileName =
strprintf(
"%s/%s.log",
132 tm *
const timeinfo = localtime(&rawtime);
134 strftime(buffer, 79,
"%Y-%m/%d", timeinfo);
146 const size_t sz = name.length();
147 for (
size_t f = 0; f < sz; f ++)
149 const unsigned char ch = name[f];
150 if ((ch < '0' || ch >
'9') &&
151 (ch < 'a' || ch >
'z') &&
152 (ch < 'A' || ch >
'Z') &&
171 const std::string &str)
173 file << str << std::endl;
189 DIR *
const dir = opendir(name.c_str());
198 std::list<std::string> &list,
199 const unsigned int n)
const
201 std::ifstream logFile;
206 logFile.open(
fileName.c_str(), std::ios::in);
208 if (!logFile.is_open())
212 unsigned sz =
CAST_U32(list.size());
213 while (logFile.getline(line, 700))
215 list.push_back(line);
224 if (logFile.is_open())
void setServerName(const std::string &serverName)
void loadLast(std::string name, std::list< std::string > &list, const unsigned int n) const
void setLogFile(const std::string &logFilename)
static void writeTo(std::ofstream &file, const std::string &str)
static std::string secureName(std::string &str)
std::string getDir() const
void setLogDir(const std::string &logDir)
void log(std::string str)
std::string getStringValue(const std::string &key) const
int mkdir_r(const char *const pathname)
Create a directory, making leading components first if necessary.
std::string removeColors(std::string msg)
std::string strprintf(const char *const format,...)
std::string pathJoin(std::string str1, const std::string &str2)