BASIC
======
* C++ logging library, depends on [`ccflag`](https://github.com/ccalvin/ccflag "C++ Command Line Flags Parser").
* Failure handler for windows, using [`StackWalker`](https://stackwalker.codeplex.com).
* Failure handler for unix, idea is from [`DeathHandler`](https://github.com/vmarkovtsev/DeathHandler).
API
======
```cpp
// @argv0 argv[0] or any valid string for a file name.
void init_cclog(const std::string& argv0);
// write all buffered logs to destination and stop the logging thread.
void StopLogging();
```
USAGE
======
* Notes
> `LOG` ==> log to file, bufferd
> `ELOG` ==> log to stderr and file, buffered
> `CHECK` ==> abort if check failed
> `DLOG` and `DCHECK` ==> do nothing if `NDEBUG` is defined
* Simple Example
```cpp
LOG << "hello" << ' ' << "world";
LOG_IF(1 + 1 == 2) << "1 + 1 = 2";
ELOG << L"hello again";
CHECK_EQ(1, 2) << "1 != 2";
```
TEST
======
* Build ==> cd test && ./build.sh
* Normal Test
```cpp
vin@envy:~/cc/cclog/test$ ./exe
0419 16:43:16 8964 test.cc:59] hello world
0419 16:43:16 8964 test.cc:62] hello again
vin@envy:~/cc/cclog/test$ cat exe.log
0419 16:43:16 8964 test.cc:50] b: true
0419 16:43:16 8964 test.cc:51] c: x
0419 16:43:16 8964 test.cc:52] i: -32
0419 16:43:16 8964 test.cc:53] d: 3.14159
0419 16:43:16 8964 test.cc:54] &c: 0x7fff28502ac8
0419 16:43:16 8964 test.cc:55] &i: 0x7fff28502acc
0419 16:43:16 8964 test.cc:56] b is true
0419 16:43:16 8964 test.cc:59] hello world
0419 16:43:16 8964 test.cc:62] hello again
```
* Exception Handler (-f=segv, chk or fpe)
```cpp
vin@envy:~/cc/cclog/test$ ./exe -f=segv
vin@envy:~/cc/cclog/test$ cat exe.log
0419 23:36:26 2997 test.cc:50] b: true
0419 23:36:26 2997 test.cc:51] c: x
0419 23:36:26 2997 test.cc:52] i: -32
0419 23:36:26 2997 test.cc:53] d: 3.14159
0419 23:36:26 2997 test.cc:54] &c: 0x7fff926903a8
0419 23:36:26 2997 test.cc:55] &i: 0x7fff926903ac
0419 23:36:26 2997 test.cc:56] b is true
0419 23:36:26 2997 test.cc:59] hello world
0419 23:36:26 2997 test.cc:62] hello again
<segmentation fault>
#0 0x4044F8 in xx::A::fa(int) at /home/vin/cc/cclog/test/test.cc:14
#1 0x404526 in xx::B::fb(int) at /home/vin/cc/cclog/test/test.cc:23
#2 0x404548 in xx::C::fc(int) at /home/vin/cc/cclog/test/test.cc:30
#3 0x40456A in xx::D::fd(int) at /home/vin/cc/cclog/test/test.cc:37
#4 0x404019 in main at /home/vin/cc/cclog/test/test.cc:67
#5 0x21EC5 in __libc_start_main at /build/buildd/eglibc-2.19/csu/libc-start.c:321
#6 0x403B6F in _start at /home/vin/cc/cclog/test/exe
```
* Flags for cclog
```cpp
--alsolog2stderr: log to stderr and file
type: bool default: false
from: ../src/cclog.cc
--log2stderr: log to stderr only
type: bool default: false
from: ../src/cclog.cc
--log_dir: log dir
type: string default: ""
from: ../src/cclog.cc
--max_log_file_size: max log file size, default: 128M
type: int64 default: 128 << 20
from: ../src/cclog.cc
```