Skip to content

Instantly share code, notes, and snippets.

@SupinePandora43
Created June 17, 2020 12:31
Show Gist options
  • Save SupinePandora43/ebaa4329cbc648fc7d43cc27b93bd9df to your computer and use it in GitHub Desktop.
Save SupinePandora43/ebaa4329cbc648fc7d43cc27b93bd9df to your computer and use it in GitHub Desktop.
// simplest file logger in c++
#include <fstream>
//#include <iostream>
static void LOG(char* message) {
//std::cout << message << std::endl;
std::fstream fs;
fs.open("log.txt", std::fstream::in | std::fstream::out | std::fstream::app);
fs << message;
fs << "\n";
fs.close();
}
static void LOG(std::string message) {
LOG(message.c_str());
}
// ---
// slow
// +++
// stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment