Skip to content

Commit

Permalink
readme: use note markup
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Dec 20, 2023
1 parent 6607b36 commit c681974
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,26 @@ the command line, log based on conditionals, abort the program when
expected conditions are not met, introduce your own verbose logging
levels, customize the prefix attached to log messages, and more.

Following sections describe the functionality supported by glog. Please note
this description may not be complete but limited to the most useful ones. If you
want to find less common features, please check header files under `src/glog
<src/glog>`__ directory.
Following sections describe the functionality supported by glog.

.. note::
This description may not be complete but limited to the most useful ones. If
you want to find less common features, please check header files under
`src/glog <src/glog>`__ directory.

Severity Levels
~~~~~~~~~~~~~~~

You can specify one of the following severity levels (in increasing
order of severity): ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL``.
Logging a ``FATAL`` message terminates the program (after the message is
logged). Note that messages of a given severity are logged not only in
the logfile for that severity, but also in all logfiles of lower
severity. E.g., a message of severity ``FATAL`` will be logged to the
logfiles of severity ``FATAL``, ``ERROR``, ``WARNING``, and ``INFO``.
logged).

**Note**
Messages of a given severity are logged not only in the logfile for that
severity, but also in all logfiles of lower severity. E.g., a message of
severity ``FATAL`` will be logged to the logfiles of severity ``FATAL``,
``ERROR``, ``WARNING``, and ``INFO``.

The ``DFATAL`` severity logs a ``FATAL`` error in debug mode (i.e.,
there is no ``NDEBUG`` macro defined), but avoids halting the program in
Expand Down Expand Up @@ -268,9 +273,11 @@ environment variables, prefixing the flag name with ``GLOG_``, e.g.,
The following flags are most commonly used:

``logtostderr`` (``bool``, default=\ ``false``)
Log messages to ``stderr`` instead of logfiles. Note: you can set
binary flags to ``true`` by specifying ``1``, ``true``, or ``yes``
(case insensitive). Also, you can set binary flags to ``false`` by
Log messages to ``stderr`` instead of logfiles.

**Note**
You can set binary flags to ``true`` by specifying ``1``, ``true``, or
``yes`` (case insensitive). Also, you can set binary flags to ``false`` by
specifying ``0``, ``false``, or ``no`` (again, case insensitive).

``stderrthreshold`` (``int``, default=2, which is ``ERROR``)
Expand Down Expand Up @@ -341,8 +348,11 @@ logging is most useful for informational messages.
LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
The above line outputs a log messages on the 1st, 11th, 21st, ... times
it is executed. Note that the special ``google::COUNTER`` value is used
to identify which repetition is happening.
it is executed.

**Note**
The special ``google::COUNTER`` value is used to identify which repetition is
happening.

You can combine conditional and occasional logging with the following
macro.
Expand Down Expand Up @@ -454,9 +464,10 @@ constructor initializer lists.
Something* ptr_;
};
Note that you cannot use this macro as a C++ stream due to this feature.
Please use ``CHECK_EQ`` described above to log a custom message before
aborting the application.
**Note**
You cannot use this macro as a C++ stream due to this feature. Please use
``CHECK_EQ`` described above to log a custom message before aborting the
application.

If you are comparing C strings (:cpp:`char *`), a handy set of macros performs
case sensitive as well as case insensitive comparisons - ``CHECK_STREQ``,
Expand All @@ -465,10 +476,10 @@ are case-insensitive. You can safely pass :cpp:`nullptr` pointers for this macro
treat :cpp:`nullptr` and any non-:cpp:`nullptr` string as not equal. Two :cpp:`nullptr`\
s are equal.

Note that both arguments may be temporary strings which are destructed
at the end of the current "full expression" (e.g.,
:cpp:`CHECK_STREQ(Foo().c_str(), Bar().c_str())` where ``Foo`` and ``Bar``
return C++’s :cpp:`std::string`).
**Note**
Both arguments may be temporary strings which are destructed at the end of the
current "full expression" (e.g., :cpp:`CHECK_STREQ(Foo().c_str(),
Bar().c_str())` where ``Foo`` and ``Bar`` return C++’s :cpp:`std::string`).

The ``CHECK_DOUBLE_EQ`` macro checks the equality of two floating point
values, accepting a small error margin. ``CHECK_NEAR`` accepts a third
Expand Down

0 comments on commit c681974

Please sign in to comment.