The log_manager
class provides a global logging facility that can be used throughout the application.
More...
#include <log_manager.hpp>
|
static void | create_logfile (const std::filesystem::path &path, log_manager *instance=nullptr) |
| Creates or re-initializes the global log file at the specified path.
|
|
static void | log_append (const std::wstring &str) |
| Appends a wide-string message to the current global log.
|
|
static void | log_append (const std::string &str) |
| Appends a narrow-string message to the current global log.
|
|
The log_manager
class provides a global logging facility that can be used throughout the application.
It maintains a singleton log_manager
instance with a shared log
object. Users can create a logfile via create_logfile(...)
and then call log_append(...)
to write logs. The log path defaults to "Cbeam.log" in the system's temporary directory if not explicitly set.
◆ ~log_manager()
cbeam::logging::log_manager::~log_manager |
( |
| ) |
|
|
inlinevirtualnoexcept |
◆ create_logfile()
void cbeam::logging::log_manager::create_logfile |
( |
const std::filesystem::path & | path, |
|
|
log_manager * | instance = nullptr ) |
|
inlinestatic |
Creates or re-initializes the global log file at the specified path.
If the log_manager singleton doesn't yet have a log, it is created with the given path. Otherwise, the existing log is used. This method is safe to call multiple times.
- Parameters
-
path | The desired log file path. |
instance | An optional pointer to an existing log_manager instance (usually null). |
◆ log_append() [1/2]
void cbeam::logging::log_manager::log_append |
( |
const std::string & | str | ) |
|
|
inlinestatic |
Appends a narrow-string message to the current global log.
Internally converted to wide-string and forwarded to log_append(const std::wstring&)
.
- Parameters
-
str | The narrow-string message to be appended. |
◆ log_append() [2/2]
void cbeam::logging::log_manager::log_append |
( |
const std::wstring & | str | ) |
|
|
inlinestatic |
Appends a wide-string message to the current global log.
If no log file was previously created, a default log file is created first.
- Parameters
-
str | The wide-string message to be appended. |
The documentation for this class was generated from the following file: