1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "../log4z.h"
#include <iostream>
#include <stdio.h>
using namespace zsummer::log4z;
int main(int argc, char *argv[])
{
//start log4z
ILog4zManager::GetInstance()->Start();
//LOGD: LOG WITH level LOG_DEBUG
//LOGI: LOG WITH level LOG_INFO
//...
LOGD(" *** " << "hellow wolrd" <<" *** ");
LOGI("loginfo");
LOGW("log warning");
LOGE("log err");
LOGA("log alarm");
LOGF("log fatal");
LOGD("char:" <<'c'
<< ", unsigned char:" << (unsigned char) 'c'
<< ", short:" << (short) -1
<< ", unsigned short:" << (unsigned short) -1
<< ", int:" << (int) -1
<< ", unsigned int:" << (unsigned int) -1
<< ", long:" << (long) -1
<< ", unsigned long:" << (unsigned long) -1
<< ", long long:" << (long long) -1
<< ", unsigned long long:" << (unsigned long long) -1
<< ", float:" << (float) -1.234567
<< ", double:" << (double) -2.34566
<< ", std::string:" << std::string("fffff")
<< ", void *:" << ( int *) argv
<< ", const void*:" << (const int *) argv
<< ", constant:" << 1000
<< ", constant:" << 100.12345678
<< ", bool:" << (bool) true);
LOGA("press anykey to exit ...");
getchar();
return 0;
}in VS join the log4z.h and log4z.cpp in linux, need append -lpthread. example: g++ -lpthread -o test main.cpp ../log4z.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* UPDATES
*
* VERSION 0.1.0 <DATE: 2010年10月4日>
* create the first project.
* It support put log to screen and files,
* support log level, support one day one log file.
* support multiple thread, multiple operating system.
*
* VERSION .... <DATE: ...>
* ...
*
* VERSION 0.9.0 <DATE: 2012年12月24日>
* support config files.
* support color text in screen.
* support multiple logger.
*
* VERSION 1.0.0 <DATE: 2012年12月29日>
* support comments in the config file.
* add a advanced demo in the ./project
* fix some details.
*
* VERSION 1.0.1 <DATE: 2013年01月01日>
* the source code haven't any change.
* fix some Comments in the log4z
* add some comments in the test projects.
* delete some needless code in the 'fast_test' demo projects, it's so simple.
*
* VERSION 1.1.0 <DATE: 2013年01月24日>
* the method Start will wait for the logger thread started.
* config and add method change.
* namespace change.
* append some macro.
*
* VERSION 1.1.1 <DATE: 2013年02月23日>
* add GetStatus**** mothed.
* optimize.
* VERSION 1.2.0 <DATE: 2013年04月05日>
* optimize.
*
*/version 1.2.1 fix some detail bug from v1.2.0 optimize. 1. need include <stdio.h> in header file. 2. new string stream format class on format <unsigned int> type will more append character 'd' .
Attachments: [log4z-1.2.0.zip] [log4z-1.2.1.zip]