Logy v1.2.2
LOGY

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
  • Supports Windows, macOS and Linux

Usage example

void loggerExampleCPP()
{
logy::Logger logger("logs", INFO_LOG_LEVEL);
int someValue = 123;
logger.log(INFO_LOG_LEVEL, "Logged value: %d", someValue);
}
Logger instance handle.
Definition logger.hpp:40
void loggerExampleC()
{
Logger logger;
LogyResult logyResult = createLogger("logs", INFO_LOG_LEVEL, true, 0.0, &logger);
if (logyResult != SUCCESS_LOGY_RESULT) abort();
int someValue = 123;
logMessage(logger, INFO_LOG_LEVEL, "Logged value: %d", someValue);
destroyLogger(logger);
}
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)

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 -j8 https://github.com/cfnptr/logy

Building CI

  • Windows: ./scripts/build-release.bat
  • macOS / Linux: ./scripts/build-release.sh

Third-party

  • mpio (Apache-2.0 License)
  • mpmt (Apache-2.0 License)