glog/docs/index.md
2024-06-12 23:58:10 +02:00

982 B

Google Logging Library

Google Logging (glog) is a C++14 library that implements application-level logging. The library provides logging APIs based on C++-style streams and various helper macros.

How to Use

You can log a message by simply streaming things to LOG(<a particular severity level>), e.g.,

#include <glog/logging.h>

int main(int argc, char* argv[]) {
    google::InitGoogleLogging(argv[0]); // (1)!
    LOG(INFO) << "Found " << num_cookies << " cookies"; // (2)!
}
  1. Initialize the Google Logging Library
  2. Log a message with informational severity

The library can be installed using various package managers or compiled from source. For a detailed overview of glog features and their usage, please refer to the user guide.

!!! warning The above example requires further Bazel or CMake setup for use in own projects.