This single-header c++20 library was created out of sheer frustration with the number of C++ logging libraries I tried which either:
- Were stupidly complicated, despite claiming to be "simple"
- Didn't even work
- Windows
- macOS
- Linux
- You can probably make it work on anything else without much effort
- Thread safe
- Just fucking logs to a file
- Fuck you
Who gives a shit. I just want to log to a file.
#include <fulog.hpp>
int main(int argc, const char* argv[]) {
fu::log("message");
}The above program creates a log file at: {logging dir}/{application name}/{log name}.log
By default:
logging diris the application data directory for the platform.application nameisfulog.log nameis the process id.
So by default, here is where the log file will go on each platform:
- Windows:
C:/Users/(username)/AppData/Roaming/fulog/(process id).log - macOS:
/Users/(username)/Library/Application Support/fulog/(process id).log - Linux:
/home/(username)/.local/share/fulog/(process id).log
fu::set_dir("/somewhere/else");fu::set_application_name("something else");fu::set_log_name("something else");fu::set_timestamp_format("{:%Y-%m-%d %H:%M:%S}");fu::debug_log("message");fu::log("INFO: fuck you");
fu::log("WARNING: just do it yourself")fu::log(std::format("fuck you: {}", "just do it yourself"));fu::log("message", std::source_location::current());fu::delete_old_files(std::chrono::hours{48});