A library providing generic API for messages logging across different platforms.
See the documentation
Features
- Logging to file, stdout
- Logging levels (fatal - trace)
- Log file rotation
- Multithreading safety
- C and C++ implementations
Usage example
void loggerExampleCPP()
{
int someValue = 123;
logger.log(INFO_LOG_LEVEL, "Logged value: %d", someValue);
}
Logger instance handle.
Definition logger.hpp:40
void loggerExampleC()
{
if (logyResult != SUCCESS_LOGY_RESULT) abort();
int someValue = 123;
logMessage(logger, INFO_LOG_LEVEL,
"Logged value: %d", someValue);
}
uint8_t LogyResult
Logy result code type.
Definition common.h:55
Logger_T * Logger
Logger instance.
Definition logger.h:44
void destroyLogger(Logger logger)
Destroys logger instance.
LogyResult createLogger(const char *directoryPath, LogLevel level, bool logToStdout, double rotationTime, bool isAppDataDirectory, Logger *logger)
Creates a new logger instance.
void logMessage(Logger logger, LogLevel level, const char *fmt,...)
Logs message to the log. (MT-Safe).
Supported operating systems
- Windows (10/11)
- Ubuntu (22.04/24.04)
- macOS (14/15)
This list includes only those systems on which functionality testing is conducted. However, you can also compile it under any other Linux distribution or operating system.
Build requirements
Use building instructions to install all required tools and libraries.
CMake options
| Name | Description | Default value |
| LOGY_BUILD_SHARED | Build Logy shared library | ON |
CMake targets
| Name | Description | Windows | macOS | Linux |
| logy-static | Static Logy library | .lib | .a | .a |
| logy-shared | Dynamic Logy library | .dll | .dylib | .so |
Cloning
git clone --recursive https://github.com/cfnptr/logy
Building 
- Windows: ./scripts/build-release.bat
- macOS / Ubuntu: ./scripts/build-release.sh
Third-party
- mpio (Apache-2.0 License)
- mpmt (Apache-2.0 License)