Commit b1afbe7b authored by 's avatar

Add google:: prefixes for COUNTER in glog's document

http://code.google.com/p/google-glog/issues/detail?id=92


git-svn-id: https://google-glog.googlecode.com/svn/trunk@95 eb4d4688-79bd-11dd-afb4-1d65580434c0
parent 54421697
...@@ -186,19 +186,19 @@ a message at certain intervals. This kind of logging is most useful ...@@ -186,19 +186,19 @@ a message at certain intervals. This kind of logging is most useful
for informational messages. for informational messages.
<pre> <pre>
LOG_EVERY_N(INFO, 10) &lt;&lt; "Got the " &lt;&lt; COUNTER &lt;&lt; "th cookie"; LOG_EVERY_N(INFO, 10) &lt;&lt; "Got the " &lt;&lt; google::COUNTER &lt;&lt; "th cookie";
</pre> </pre>
<p>The above line outputs a log messages on the 1st, 11th, <p>The above line outputs a log messages on the 1st, 11th,
21st, ... times it is executed. Note that the special 21st, ... times it is executed. Note that the special
<code>COUNTER</code> value is used to identify which repetition is <code>google::COUNTER</code> value is used to identify which repetition is
happening. happening.
<p>You can combine conditional and occasional logging with the <p>You can combine conditional and occasional logging with the
following macro. following macro.
<pre> <pre>
LOG_IF_EVERY_N(INFO, (size &gt; 1024), 10) &lt;&lt; "Got the " &lt;&lt; COUNTER LOG_IF_EVERY_N(INFO, (size &gt; 1024), 10) &lt;&lt; "Got the " &lt;&lt; google::COUNTER
&lt;&lt; "th big cookie"; &lt;&lt; "th big cookie";
</pre> </pre>
...@@ -206,11 +206,11 @@ following macro. ...@@ -206,11 +206,11 @@ following macro.
the output to the first n occurrences: the output to the first n occurrences:
<pre> <pre>
LOG_FIRST_N(INFO, 20) &lt;&lt; "Got the " &lt;&lt; COUNTER &lt;&lt; "th cookie"; LOG_FIRST_N(INFO, 20) &lt;&lt; "Got the " &lt;&lt; google::COUNTER &lt;&lt; "th cookie";
</pre> </pre>
<p>Outputs log messages for the first 20 times it is executed. Again, <p>Outputs log messages for the first 20 times it is executed. Again,
the <code>COUNTER</code> identifier indicates which repetition is the <code>google::COUNTER</code> identifier indicates which repetition is
happening. happening.
<h2><A NAME=debug>Debug Mode Support</A></h2> <h2><A NAME=debug>Debug Mode Support</A></h2>
...@@ -225,7 +225,7 @@ application due to excessive logging. ...@@ -225,7 +225,7 @@ application due to excessive logging.
DLOG_IF(INFO, num_cookies &gt; 10) &lt;&lt; "Got lots of cookies"; DLOG_IF(INFO, num_cookies &gt; 10) &lt;&lt; "Got lots of cookies";
DLOG_EVERY_N(INFO, 10) &lt;&lt; "Got the " &lt;&lt; COUNTER &lt;&lt; "th cookie"; DLOG_EVERY_N(INFO, 10) &lt;&lt; "Got the " &lt;&lt; google::COUNTER &lt;&lt; "th cookie";
</pre> </pre>
<h2><A NAME=check>CHECK Macros</A></h2> <h2><A NAME=check>CHECK Macros</A></h2>
...@@ -392,11 +392,11 @@ opposed to a severity level. ...@@ -392,11 +392,11 @@ opposed to a severity level.
"program with --v=1 or more"; "program with --v=1 or more";
VLOG_EVERY_N(1, 10) VLOG_EVERY_N(1, 10)
&lt;&lt; "I'm printed every 10th occurrence, and when you run the program " &lt;&lt; "I'm printed every 10th occurrence, and when you run the program "
"with --v=1 or more. Present occurence is " &lt;&lt; COUNTER; "with --v=1 or more. Present occurence is " &lt;&lt; google::COUNTER;
VLOG_IF_EVERY_N(1, (size &gt; 1024), 10) VLOG_IF_EVERY_N(1, (size &gt; 1024), 10)
&lt;&lt; "I'm printed on every 10th occurence of case when size is more " &lt;&lt; "I'm printed on every 10th occurence of case when size is more "
" than 1024, when you run the program with --v=1 or more. "; " than 1024, when you run the program with --v=1 or more. ";
"Present occurence is " &lt;&lt; COUNTER; "Present occurence is " &lt;&lt; google::COUNTER;
</pre> </pre>
<h2> <A name="signal">Failure Signal Handler</A> </h2> <h2> <A name="signal">Failure Signal Handler</A> </h2>
......
...@@ -152,21 +152,21 @@ typedef unsigned __int64 uint64; ...@@ -152,21 +152,21 @@ typedef unsigned __int64 uint64;
// You can also do occasional logging (log every n'th occurrence of an // You can also do occasional logging (log every n'th occurrence of an
// event): // event):
// //
// LOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie"; // LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
// //
// The above will cause log messages to be output on the 1st, 11th, 21st, ... // The above will cause log messages to be output on the 1st, 11th, 21st, ...
// times it is executed. Note that the special COUNTER value is used to // times it is executed. Note that the special google::COUNTER value is used
// identify which repetition is happening. // to identify which repetition is happening.
// //
// You can also do occasional conditional logging (log every n'th // You can also do occasional conditional logging (log every n'th
// occurrence of an event, when condition is satisfied): // occurrence of an event, when condition is satisfied):
// //
// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER // LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
// << "th big cookie"; // << "th big cookie";
// //
// You can log messages the first N times your code executes a line. E.g. // You can log messages the first N times your code executes a line. E.g.
// //
// LOG_FIRST_N(INFO, 20) << "Got the " << COUNTER << "th cookie"; // LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
// //
// Outputs log messages for the first 20 times it is executed. // Outputs log messages for the first 20 times it is executed.
// //
...@@ -183,7 +183,7 @@ typedef unsigned __int64 uint64; ...@@ -183,7 +183,7 @@ typedef unsigned __int64 uint64;
// //
// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; // DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
// //
// DLOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie"; // DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
// //
// All "debug mode" logging is compiled away to nothing for non-debug mode // All "debug mode" logging is compiled away to nothing for non-debug mode
// compiles. // compiles.
...@@ -227,11 +227,11 @@ typedef unsigned __int64 uint64; ...@@ -227,11 +227,11 @@ typedef unsigned __int64 uint64;
// "program with --v=1 or more"; // "program with --v=1 or more";
// VLOG_EVERY_N(1, 10) // VLOG_EVERY_N(1, 10)
// << "I'm printed every 10th occurrence, and when you run the program " // << "I'm printed every 10th occurrence, and when you run the program "
// "with --v=1 or more. Present occurence is " << COUNTER; // "with --v=1 or more. Present occurence is " << google::COUNTER;
// VLOG_IF_EVERY_N(1, (size > 1024), 10) // VLOG_IF_EVERY_N(1, (size > 1024), 10)
// << "I'm printed on every 10th occurence of case when size is more " // << "I'm printed on every 10th occurence of case when size is more "
// " than 1024, when you run the program with --v=1 or more. "; // " than 1024, when you run the program with --v=1 or more. ";
// "Present occurence is " << COUNTER; // "Present occurence is " << google::COUNTER;
// //
// The supported severity levels for macros that allow you to specify one // The supported severity levels for macros that allow you to specify one
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL. // are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment