diff --git a/Src/IACore/imp/cpp/Logger.cpp b/Src/IACore/imp/cpp/Logger.cpp index 4ab00d9..1827e54 100644 --- a/Src/IACore/imp/cpp/Logger.cpp +++ b/Src/IACore/imp/cpp/Logger.cpp @@ -1,16 +1,16 @@ -// IACore-OSS; The Core Library for All IA Open Source Projects +// IACore-OSS; The Core Library for All IA Open Source Projects // Copyright (C) 2025 IAS (ias@iasoft.dev) -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -50,12 +50,16 @@ namespace IACore s_logLevel = logLevel; } - VOID Logger::LogInternal(IN PCCHAR prefix, IN PCCHAR tag, IN String&& msg) + VOID Logger::LogInternal(IN PCCHAR prefix, IN PCCHAR tag, IN String &&msg) { std::chrono::duration elapsed = HRClock::now() - s_startTime; double timestamp = elapsed.count(); - const auto outLine = std::format("{} [{:>8.3f}]: [{}]: {}\033[39m\n", prefix, timestamp, tag, msg); - const auto outStream = s_logFile ? s_logFile->GetStreamHandle() : &std::cout; - outStream->write(outLine.data(), outLine.size()); + const auto outLine = std::format("[{:>8.3f}]: [{}]: {}", timestamp, tag, msg); + std::cout << prefix << outLine << "\033[39m\n"; + if (s_logFile) + { + s_logFile->GetStreamHandle()->write(outLine.data(), outLine.size()); + s_logFile->GetStreamHandle()->put('\n'); + } } -} \ No newline at end of file +} // namespace IACore \ No newline at end of file