From 133b40fd55443da08bc82b158bc6729b5bd87821 Mon Sep 17 00:00:00 2001 From: Date: Fri, 25 Jan 2013 06:03:56 +0000 Subject: [PATCH] Document update: how to modify FLAGS_* in glog http://code.google.com/p/google-glog/issues/detail?id=70 git-svn-id: https://google-glog.googlecode.com/svn/trunk@126 eb4d4688-79bd-11dd-afb4-1d65580434c0 --- doc/glog.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/glog.html b/doc/glog.html index a104659..8b200ba 100644 --- a/doc/glog.html +++ b/doc/glog.html @@ -168,6 +168,25 @@ See also the section about verbose logging.

There are some other flags defined in logging.cc. Please grep the source code for "DEFINE_" to see a complete list of all flags. +

You can also modify flag values in your program by modifying global +variables FLAGS_* . Most settings start working +immediately after you update FLAGS_* . The exceptions are +the flags related to destination files. For example, you might want to +set FLAGS_log_dir before +calling google::InitGoogleLogging . Here is an example: + +

+   LOG(INFO) << "file";
+   // Most flags work immediately after updating values.
+   FLAGS_logtostderr = 1;
+   LOG(INFO) << "stderr";
+   FLAGS_logtostderr = 0;
+   // This won't change the log destination. If you want to set this
+   // value, you should do this before google::InitGoogleLogging .
+   FLAGS_log_dir = "/some/log/directory";
+   LOG(INFO) << "the same file";
+
+

Conditional / Occasional Logging

Sometimes, you may only want to log a message under certain -- 2.7.4