18 static llvm::raw_ostream &
logs(
const std::string &Name) {
19 static Logger SingletonLogger{Name};
20 return SingletonLogger.OutStream;
24 static void logfile(
const std::string &Filename, T &&Data) {
26 llvm::raw_fd_ostream Out(std::string(LogDir) +
"/" +
27 std::to_string(getpid()) +
"." + Filename,
30 throw std::runtime_error(
"Error opening file: " + EC.message());
36 static constexpr char LogDir[] =
".proteus-logs";
39 llvm::raw_fd_ostream OutStream;
41 Logger(
const std::string &Name)
42 : DirExists(
std::filesystem::create_directory(LogDir)),
43 OutStream(llvm::raw_fd_ostream{
std::string(LogDir) +
"/" + Name +
"." +
44 std::to_string(getpid()) +
".log",
45 EC, llvm::sys::fs::OF_None}) {
47 throw std::runtime_error(
"Error opening file: " + EC.message());