void Log::SetLogFile (const std::string& fullFilePath) { auto logFile = new std::ofstream (fullFilePath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); if (logFile->is_open ()) { SetLogStream (logFile); LogPrint("Logging to file ", fullFilePath, " enabled."); } else delete logFile; }
void Log::SetLogFile (const std::string& fullFilePath) { auto logFile = new std::ofstream (fullFilePath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); if (logFile->is_open ()) { SetLogStream (logFile); LogPrint(eLogInfo, "Log: will send messages to ", fullFilePath); } else delete logFile; }
nsresult nsMsgFilterList::TruncateLog() { // this will flush and close the steam nsresult rv = SetLogStream(nullptr); NS_ENSURE_SUCCESS(rv,rv); nsCOMPtr <nsIFile> file; rv = GetLogFile(getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv,rv); file->Remove(false); rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644); NS_ENSURE_SUCCESS(rv,rv); return rv; }