- Easy to use - simple API, works out of the box
- Advanced filtering and log levels per topic or output
- Thread-safety via external locking injection
- Customization - only data you need
- Extensible - add your own features via public API, set of predefined extensions
- Support for embedded systems static allocation, small size
- Easy to install two files for copy-paste and support for many build systems
- For everyone - C and C++ support, works with any compiler, any platform, commercial or open-source use
In the default configuration it looks like this:
![]() |
---|
Picture 1 - default configuration: no time, long default levels, source location, no topics, no colors |
...but in can be very minimalistic :
![]() |
---|
Picture 2 - short levels, no colors, no time, no source location |
... or feature-rich:
![]() |
---|
Picture 3 - time, custom prefix for MsgID, custom syslog levels, topics, source location, colors |
The project is based on the following core principles:
- Universal for embedded and desktop applications
- No feature - no code for compilation
- Shallow learning curve, works out of box
- No dependencies
- Two files for core functionality.
- Extensions as recipes for your own features.
Option 1 - Sources:
- Download a Source Package from Releases
- Add sources to your system manually
Option 2 - CMake Package (recommended CMake > 3.15.0):
- Download a CMake Package from Releases
- Specify the install location:
- Specify package storage
cmake -B./build -DCMAKE_PREFIX_PATH="~/MyCmakePackages"
or - Set
microlog_DIR
variable with path to the packagemicrolog_DIR=~/microlog-1.2.3-cmake
- Specify package storage
- Use in your project:
find_package(microlog 1.2.3 REQUIRED)
add_executable(example_package example.cpp)
target_link_libraries(example_package PRIVATE microlog::microlog)
target_compile_definitions(microlog PRIVATE ULOG_BUILD_COLOR=1) # configuration
Option 3 - Meson Package:
- Download a Meson Package from Releases
- Copy the content to
MyMesonProject/subprojects
- Add to your dependencies:
add_global_arguments('-DULOG_BUILD_COLOR=1', language: ['cpp', 'c']) # configuration
exe = executable(
meson.project_name(),
src,
include_directories: include,
dependencies: dependency('microlog'),
)
Option 4 - Meson Wrap File:
- Download the wrap file from Releases
- Place
microlog.wrap
in yourMyMesonProject/subprojects/
directory - Add to your dependencies as in Option 3
Option 5 - CPM:
- Download CPM (https://github.com/cpm-cmake/CPM.cmake)
- Add microlog to your projects CMAKE file:
include(cpm/CPM.cmake)
CPMAddPackage("gh:an-dr/[email protected]")
target_link_libraries(${PROJECT_NAME} PUBLIC microlog::microlog)
target_compile_definitions( microlog
INTERFACE
ULOG_BUILD_COLOR=1) # configuration
#include "ulog.h"
int main() {
ulog_info("Hello, World");
return 0;
}
Output:
INFO src/main.cpp:4: Hello, World
Add missing functionalities via API or use predefined extensions. See Extensions documentation.
User Manual in doc/features.md
- detailed information about the available features.
Extensions - Optional add-ons that use only the public API to enhance functionality.
See the example for more features in action: example/main.cpp
.
Contributions are welcome! Please read the CONTRIBUTING.md for details, I tried to keep it simple.
See CHANGELOG.md for details.
This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details.