Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use glog Log Library in Linux Environment

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use glog log library in Linux environment? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

Generate linux library

Centos7.3 used in the Linux version, compiled to generate a library

1. Cd glog-0.3.3

2.. / configure

3. Make

After the completion of make, the corresponding library files will be generated under .lib.

Using glog Library under Linux

Linux uses static libraries to test. The header files of copy static libraries libglog.an and src/glog go to your project directory, create main.cpp files, and add the following code:

/ * Copyright (C), 2016-2018 FileName: mainDescription: Glog uses Demo***/#include # include "glog/logging.h" int main () {/ / initialization parameter FLAGS_logtostderr = FALSE / / TRUE: standard output, FALSE: file output FLAGS_alsologtostderr = TRUE; / / whether standard output FLAGS_colorlogtostderr = FALSE; / / standard output with color FLAGS_logbufsecs = 0 is required besides log files; / / set the maximum number of seconds that logs can be buffered, 0 means real-time output FLAGS_max_log_size = 10; / / log file size (in MB) FLAGS_stop_logging_if_full_disk = true / / whether disk google::InitGoogleLogging ("mqttserver") is recorded when the disk is full; google::SetLogDestination (google::GLOG_INFO, ". / test"); LOG (INFO)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report