Cbeam
Loading...
Searching...
No Matches
log_manager.hpp File Reference
#include <cassert>
#include <atomic>
#include <filesystem>
#include <iostream>
#include <memory>
#include <mutex>
#include <string>
#include "detail/logging_impl.hpp"
#include <cbeam/convert/string.hpp>
Include dependency graph for log_manager.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cbeam::logging::log_manager
 The log_manager class provides a global logging facility that can be used throughout the application. More...
 

Namespaces

namespace  cbeam
 The root namespace for the Cbeam library. This namespace unifies cross-platform utilities for concurrency, memory management, file handling, logging, serialization, and more. Its purpose is to provide a cohesive collection of modern C++ components that address common system-level and application-level tasks, while promoting thread-safety, interprocess communication, and stable resource handling across varied platform APIs.
 
namespace  cbeam::logging
 Offers flexible logging mechanisms to record messages with timestamps and thread information. The log_manager can create or reinitialize log files at runtime, appending text from multiple threads safely, while log handles file writes with concurrency considerations. Debug-logging macros are also provided for conditional compilation.
 

Macros

#define CBEAM_DEBUG_LOGGING   0
 Controls debug logging within the Cbeam library.
 
#define CBEAM_LOG(s)
 Logs a message using cbeam::logging::log_manager.
 
#define CBEAM_LOG_DEBUG(s)
 Logs a debug message if CBEAM_DEBUG_LOGGING is enabled.
 

Macro Definition Documentation

◆ CBEAM_DEBUG_LOGGING

#define CBEAM_DEBUG_LOGGING   0

Controls debug logging within the Cbeam library.

When this macro is defined and set to 1, debug log messages are enabled. Otherwise, if it is set to 0 or not defined, debug log messages are suppressed.

Note
This macro can be defined in project settings or directly in code before including cbeam headers. The default behavior is to enable debug logging if the _DEBUG macro is defined.

◆ CBEAM_LOG

#define CBEAM_LOG ( s)
Value:
static void log_append(const std::wstring &str)
Appends a wide-string message to the current global log.
Definition log_manager.hpp:187

Logs a message using cbeam::logging::log_manager.

This macro logs a message, regardless of the CBEAM_DEBUG_LOGGING setting. It uses the cbeam::logging::log_manager to append the log message.

Parameters
sThe message string to log.

◆ CBEAM_LOG_DEBUG

#define CBEAM_LOG_DEBUG ( s)

Logs a debug message if CBEAM_DEBUG_LOGGING is enabled.

This macro logs a debug message using cbeam::logging::log_manager, but only if CBEAM_DEBUG_LOGGING is defined and set to 1. If CBEAM_DEBUG_LOGGING is not defined or set to 0, this macro does nothing.

Note
CBEAM_DEBUG_LOGGING can be set by the project that includes cbeam headers.
Parameters
sThe message string to log.