X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=doc%2Fglog.html;h=8b200bacaf7187e297668c74d1138f3fe3313e3d;hb=4682134d59e4f206ba94dc54071dc27c6836a5ce;hp=a2d093d9c7a1ed70383736afe0616e33b1a1f2f7;hpb=b1afbe7b3caab5cc4a3ffa6d9250adb282508e62;p=platform%2Fupstream%2Fglog.git diff --git a/doc/glog.html b/doc/glog.html index a2d093d..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 @@ -527,8 +546,48 @@ all log messages associated with VLOGs as well as

Notes for Windows users

Google glog defines a severity level ERROR, which is -also defined in windows.h -There are two known workarounds to avoid this conflict: +also defined in windows.h . You can make glog not define +INFO, WARNING, ERROR, +and FATAL by defining +GLOG_NO_ABBREVIATED_SEVERITIES before +including glog/logging.h . Even with this macro, you can +still use the iostream like logging facilities: + +

+  #define GLOG_NO_ABBREVIATED_SEVERITIES
+  #include <windows.h>
+  #include <glog/logging.h>
+
+  // ...
+
+  LOG(ERROR) << "This should work";
+  LOG_IF(ERROR, x > y) << "This should be also OK";
+
+ +

+However, you cannot +use INFO, WARNING, ERROR, +and FATAL anymore for functions defined +in glog/logging.h . + +

+  #define GLOG_NO_ABBREVIATED_SEVERITIES
+  #include <windows.h>
+  #include <glog/logging.h>
+
+  // ...
+
+  // This won't work.
+  // google::FlushLogFiles(google::ERROR);
+
+  // Use this instead.
+  google::FlushLogFiles(google::GLOG_ERROR);
+
+ +

+If you don't need ERROR defined +by windows.h, there are a couple of more workarounds +which sometimes don't work: