Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/logit_cpp/LogIt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "LogItConfig.hpp"
#include "logit/enums.hpp"
#include "logit/utils.hpp"
#include "logit/TaskExecutor.hpp"
#include "logit/Logger.hpp"
#include "logit/LogStream.hpp"
#include "logit/LogMacros.hpp"
Expand Down
3 changes: 2 additions & 1 deletion include/logit_cpp/logit/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "loggers/ILogger.hpp"
#include "formatter.hpp"
#include "detail/TaskExecutor.hpp"
#include <memory>
#include <mutex>
#include <sstream>
Expand Down Expand Up @@ -239,7 +240,7 @@ namespace logit {
if (m_shutdown) return;
m_shutdown = true;
wait();
TaskExecutor::get_instance().shutdown();
detail::TaskExecutor::get_instance().shutdown();
}

private:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef _LOGIT_TASK_EXECUTOR_HPP_INCLUDED
#define _LOGIT_TASK_EXECUTOR_HPP_INCLUDED
#ifndef _LOGIT_DETAIL_TASK_EXECUTOR_HPP_INCLUDED
#define _LOGIT_DETAIL_TASK_EXECUTOR_HPP_INCLUDED

/// \file TaskExecutor.hpp
/// \brief Defines the TaskExecutor class, which manages task execution in a separate thread.
Expand All @@ -13,7 +13,7 @@
#include <iostream>
#include <chrono>

namespace logit {
namespace logit { namespace detail {

#if defined(__EMSCRIPTEN__)

Expand Down Expand Up @@ -136,6 +136,6 @@ namespace logit {

#endif // defined(__EMSCRIPTEN__)

}; // namespace logit
}} // namespace logit::detail

#endif // _LOGIT_TASK_EXECUTOR_HPP_INCLUDED
#endif // _LOGIT_DETAIL_TASK_EXECUTOR_HPP_INCLUDED
5 changes: 3 additions & 2 deletions include/logit_cpp/logit/loggers/ConsoleLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/// \brief Console logger implementation that outputs logs to the console with color support.

#include "ILogger.hpp"
#include "logit/detail/TaskExecutor.hpp"
#include <iostream>
#if defined(_WIN32)
#include <windows.h>
Expand Down Expand Up @@ -105,7 +106,7 @@ namespace logit {
return;
}
lock.unlock();
TaskExecutor::get_instance().add_task([this, message](){
detail::TaskExecutor::get_instance().add_task([this, message](){
std::lock_guard<std::mutex> lock(m_mutex);
# if defined(_WIN32)
// For Windows, parse the message for ANSI color codes and apply them
Expand Down Expand Up @@ -181,7 +182,7 @@ namespace logit {
std::unique_lock<std::mutex> lock(m_mutex);
if (!m_config.async) return;
lock.unlock();
TaskExecutor::get_instance().wait();
detail::TaskExecutor::get_instance().wait();
#endif
}

Expand Down
5 changes: 3 additions & 2 deletions include/logit_cpp/logit/loggers/FileLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/// \brief File logger implementation that outputs logs to files with rotation and deletion of old logs.

#include "ILogger.hpp"
#include "logit/detail/TaskExecutor.hpp"
#include <iostream>
#include <fstream>
#include <mutex>
Expand Down Expand Up @@ -117,7 +118,7 @@ namespace logit {
return;
}
auto timestamp_ms = record.timestamp_ms;
TaskExecutor::get_instance().add_task([this, message, timestamp_ms]() {
detail::TaskExecutor::get_instance().add_task([this, message, timestamp_ms]() {
std::lock_guard<std::mutex> lock(m_mutex);
try {
write_log(message, timestamp_ms);
Expand Down Expand Up @@ -181,7 +182,7 @@ namespace logit {
/// \brief Waits for all asynchronous tasks to complete.
void wait() override {
if (!m_config.async) return;
TaskExecutor::get_instance().wait();
detail::TaskExecutor::get_instance().wait();
}

private:
Expand Down
5 changes: 3 additions & 2 deletions include/logit_cpp/logit/loggers/UniqueFileLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/// \brief Logger that writes each log message to a unique file with auto-deletion of old logs.

#include "ILogger.hpp"
#include "logit/detail/TaskExecutor.hpp"
#include <iostream>
#include <fstream>
#include <mutex>
Expand Down Expand Up @@ -163,7 +164,7 @@ namespace logit {
info_lock.unlock();

auto timestamp_ms = record.timestamp_ms;
TaskExecutor::get_instance().add_task([this, message, timestamp_ms, thread_id]() {
detail::TaskExecutor::get_instance().add_task([this, message, timestamp_ms, thread_id]() {
std::lock_guard<std::mutex> lock(m_mutex);
std::string file_path;
try {
Expand Down Expand Up @@ -253,7 +254,7 @@ namespace logit {
/// \brief Waits for all asynchronous tasks to complete.
void wait() override {
if (!m_config.async) return;
TaskExecutor::get_instance().wait();
detail::TaskExecutor::get_instance().wait();
}

private:
Expand Down
Loading