[glog usage and display style]

<glog/logging.h>It is the core header file of Google Logging Library (glog). glog provides a powerful logging tool for C++, especially when used with other Google libraries, such as gflags.

1. Purpose

  • Generation of log messages : You can easily log messages anywhere in your code.
  • Log level control : For example, you can choose to log only error messages and ignore information or debug messages.
  • Log destination control : By default, logs are written to a file, but you can change this to redirect them elsewhere, such as the console.
  • Log cutting : Automatically cut logs based on size or time.
  • Error handling : Stack traces can be automatically logged when fatal errors are encountered.

2. Usage

Here are some basic usages of the library:

2.1 Initialize glog

At the beginning of your main()function, you should call google::InitGoogleLogging:

int main(int argc

Guess you like

Origin blog.csdn.net/qq_21950671/article/details/132733353