libsir is a cross-platform, thread-safe C (C11) logging library that is designed to simplify and streamline the generation of human-readable information in software.
Using libsir, you can make a single call that simultaneously sends information to multiple destinations, each with their own individual preference for format and levels. See the documentation for more information.
Each 'level' or 'priority' of output can be visually styled however you wish for stdio
destinations. This allows for immediate visual confirmation that a message appeared in the terminal that you should pay attention to, while less pressing information is more subtle in appearance.
Why should you use libsir instead of another logging library? I don't know, why should you? Just kidding:
- No dependencies other than
pthreads
. On Windows, libsir uses the native sychronization API. - Accompanied by a robust test suite to ensure dependable behavior, even if you make modifications to the source.
- Won't fail silently—C library or platform level errors are captured and stored for posterity, on a per-thread basis. The function, file, and line number from which it orginated are also captured. Additionally, libsir defines its own set of error messages to aid in troubleshooting.
- Hardened—every function contains sanity checks for internal state as well as arguments passed in through the external interfaces. libsir's make recipes use –Wpedantic, too.
- Full documentation, thanks to Doxygen.
I've successfully compiled and verified the test suite in these environments:
Compiler | Version | OS | Architecture |
---|---|---|---|
gcc | 5.4.0 | Ubuntu 16.04 | x64 |
gcc | 7.3.0 | Ubuntu 18.04 | armhf |
gcc | 7.3.0 (MinGW) | Windows 10 | x64 |
clang | 9.1.0 | macOS 10.13.4 | x64 |
Please see the documentation for further information about libsir.