Skip to content

Commit ec90c74

Browse files
log_vlog.cpp
1 parent bf3284c commit ec90c74

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

glog/log_vlog.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <glog/logging.h>
2+
3+
//g++ glog.cpp -lglog
4+
//GLOG_v=7 GLOG_logtostderr=1 ./a.out
5+
6+
//https://stackoverflow.com/questions/40394102/vlog-doesnt-work-for-google-logging-library-glog
7+
8+
int main(int argc, char* argv[]) {
9+
// Initialize Google's logging library.
10+
google::InitGoogleLogging(argv[0]);
11+
int i = 3;
12+
13+
LOG(INFO) << "Found " << 3 << " cookies";
14+
LOG(ERROR) << "Found " << 3 << " cookies";
15+
VLOG(5) << "vlog" << 4 << "abc" << 4.3 << i;
16+
}
17+
18+
/*
19+
I0109 14:14:01.028268 30790 glog.cpp:11] Found 3 cookies
20+
E0109 14:14:01.028389 30790 glog.cpp:12] Found 3 cookies
21+
I0109 14:14:01.028403 30790 glog.cpp:13] vlog4abc4.33
22+
*/

0 commit comments

Comments
 (0)