Simple C++ Logging Library
HollowLog is a lightweight and easy-to-use logging library for C++ applications. It provides a simple interface for logging messages with different severity levels, making it easier to track application behavior and debug issues.
- C++17 (or newer)
To use HollowLog in your C++ project, follow these steps:
- Download the
HollowLogdirectory inincludefrom the repository and place it into your source code. #includethe header file in your source code:#include "HollowLog/HollowLog.h"
- To log messages, start by setting/specifying the initial log level (ERROR, WARN, INFO = default, DEBUG, TRACE):
OR (if you want to log SPECIFIC levels, use bitwise OR with
HollowLog::set(HollowLog::YOUR_LOG_LEVEL);specify())HollowLog::specify(HollowLog::YOUR_LOG_LEVEL | ...); - Use the logging functions to log messages at different severity levels:
OR (using formatting)
HollowLog::error("This is an error message."); HollowLog::warn("This is a warning message."); HollowLog::info("This is an informational message."); HollowLog::debug("This is a debug message."); HollowLog::trace("This is a trace message.");
OR (using categories)HollowLog::error("%s", "This is an error message."); HollowLog::warn("%d", 123); HollowLog::info("%f", 3.14); HollowLog::debug("%x", 255); HollowLog::trace("%s Some Number: %d", "This is a trace message.", 43);
HollowLog::errorCat("Category", "%s", "This is an error message."); HollowLog::warnCat("SomeCategory", "This is a warning message."); HollowLog::infoCat("IDK", "%f", 3.14); HollowLog::debugCat(":0", "This is a debug message."); HollowLog::traceCat("XD", "%s Some Number: %d", "This is a trace message.", 43);
If you want to change the log level at any point in your application, simply call the
set() or specify() function again with the desired log level(s).
That's it! You can now log messages in your C++ application using HollowLog!
HollowLog is currently a work in progress. Future updates may include additional features such as:
- File Logging
- And More?