about summary refs log tree commit diff
path: root/third_party/glog/bazel/example
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-27T00·26+0100
committerVincent Ambo <tazjin@google.com>2020-05-27T00·26+0100
commit6941048b7e55ec85ec257c4f597e7f0d54e1584d (patch)
tree35b90141e36142f5ebb5910fc0b08e0018e4486a /third_party/glog/bazel/example
parent7dc094173b641c78a449395cc6f28a5e52b6fe64 (diff)
parentafe04691aca3f669f517adaeb5bd4a87a481fb4a (diff)
merge(3p/glog): Vendor glog from commit 'afe04691' r/863
Diffstat (limited to 'third_party/glog/bazel/example')
-rw-r--r--third_party/glog/bazel/example/BUILD8
-rw-r--r--third_party/glog/bazel/example/main.cc22
2 files changed, 30 insertions, 0 deletions
diff --git a/third_party/glog/bazel/example/BUILD b/third_party/glog/bazel/example/BUILD
new file mode 100644
index 000000000000..6b10e2b2fb3f
--- /dev/null
+++ b/third_party/glog/bazel/example/BUILD
@@ -0,0 +1,8 @@
+cc_test(
+    name = "main",
+    size = "small",
+    srcs = ["main.cc"],
+    deps = [
+        "//:glog",
+    ],
+)
diff --git a/third_party/glog/bazel/example/main.cc b/third_party/glog/bazel/example/main.cc
new file mode 100644
index 000000000000..fef01dc15752
--- /dev/null
+++ b/third_party/glog/bazel/example/main.cc
@@ -0,0 +1,22 @@
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+#include <glog/stl_logging.h>
+
+int main(int argc, char* argv[]) {
+  // Initialize Google's logging library.
+  google::InitGoogleLogging(argv[0]);
+
+  // Optional: parse command line flags
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
+
+  LOG(INFO) << "Hello, world!";
+
+  // glog/stl_logging.h allows logging STL containers.
+  std::vector<int> x;
+  x.push_back(1);
+  x.push_back(2);
+  x.push_back(3);
+  LOG(INFO) << "ABC, it's easy as " << x;
+
+  return 0;
+}