https://github.com/pragkent/logbox
A pragmatic C++ logging library
https://github.com/pragkent/logbox
Last synced: 3 months ago
JSON representation
A pragmatic C++ logging library
- Host: GitHub
- URL: https://github.com/pragkent/logbox
- Owner: pragkent
- License: mit
- Created: 2015-02-10T15:43:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-02T11:52:15.000Z (over 9 years ago)
- Last Synced: 2024-12-31T15:19:13.725Z (5 months ago)
- Language: C++
- Size: 360 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Logbox
[](https://travis-ci.org/pragkent/logbox)Logbox is a pragmatic logging library for C++.
## Introduction
It could be used like this:```cpp
#includeint main(int argc, char* argv[]) {
logbox::InitializeLogging();LOG(DEBUG) << "Hello world!";
return 0;
}
```## Logging Style
Logbox supports three different styles of logging:* Stream Style:
```cpp
LOG(DEBUG) << "This is a cool debug log";
```* Format Style:
```cpp
LOG(INFO).Write("We find {} cookies", num_of_cookies);
```* Printf Style
```cpp
LOG(ERROR).Printf("We can use printf! %s", "Yeah!");
```## Conditional Logging
You can do conditional logging this way:
```cpp
LOG_IF(DEBUG, num > 10) << "Too many cookies to eat!";
LOG_IF(INFO, num > 10).Write("We got {} cookies!", num);
```## Format String Syntax
Logbox use `cppformat`(https://github.com/cppformat/cppformat) library for
formatting. You can check format string syntax here:
http://cppformat.readthedocs.org/en/latest/syntax.html## Install
```bash
git clone https://github.com/pragkent/logbox.git
cd logbox
./build.sh
```## Acknowledgments
Thanks `Victor Zverovich`(https://github.com/vitaut) for `cppformat`(https://github.com/cppformat/cppformat).