Skip to content

Commit c359348

Browse files
authored
chore: document that NullLogger is the default (#189)
* chore: document that `NullLogger` is the default Commit [9f7d0aa][1] introduced `NullLogger` as the default logger, replacing `CerrLogger`. This revision updates some relevant documentation. I used `git grep CerrLogger` and [check-markdown-links][2] to find the mismatches. [1]: 9f7d0aa [2]: https://github.com/dgoffredo/check-markdown-links
1 parent 7fb5e59 commit c359348

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

doc/maintainers.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,11 @@ be to have versions of the `Error`-returning operations that instead accept a
605605
the present state of things is acceptable and that such a change is not
606606
warranted.
607607

608-
The default implementation of `Logger` is `CerrLogger`, defined in
609-
[cerr_logger.h][42]. `CerrLogger` logs to [std::cerr][43] in both `log_error`
608+
The default implementation of `Logger` is `NullLogger`, defined in
609+
[null_logger.h][47]. `NullLogger` doesn't log anything.
610+
611+
A client library might wish to install `CerrLogger` instead. `CerrLogger` is
612+
defined in [cerr_logger.h][42] and logs to [std::cerr][43] in both `log_error`
610613
and `log_startup`.
611614

612615
The `Logger` used by a `Tracer` is configured via `std::shared_ptr<Logger>
@@ -690,8 +693,9 @@ TODO
690693
[39]: https://en.cppreference.com/w/cpp/utility/variant/get_if
691694
[40]: https://en.cppreference.com/w/cpp/language/value_category
692695
[41]: ../include/datadog/logger.h
693-
[42]: ../src/datadog/cerr_logger.h
696+
[42]: ../include/datadog/cerr_logger.h
694697
[43]: https://en.cppreference.com/w/cpp/io/cerr
695698
[44]: https://en.cppreference.com/w/cpp/utility/functional/function
696699
[45]: https://github.com/DataDog/datadog-agent/blob/796ccb9e92326c85b51f519291e86eb5bc950180/pkg/trace/api/endpoints.go#L97
697700
[46]: https://github.com/DataDog/dd-trace-cpp/tree/david.goffredo/traception
701+
[47]: ../src/datadog/null_logger.h

include/datadog/cerr_logger.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
// This component provides a class, `CerrLogger`, that implements the `Logger`
44
// interface from `logger.h`. `CerrLogger` prints to `std::cerr`, which is
55
// typically an unbuffered stream to the standard error file.
6-
//
7-
// `CerrLogger` is the default logger used by `Tracer` unless otherwise
8-
// configured in `TracerConfig`.
96

107
#include <datadog/logger.h>
118

include/datadog/tracer_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ struct TracerConfig {
122122
Optional<std::size_t> max_tags_header_size;
123123

124124
// `logger` specifies how the tracer will issue diagnostic messages. If
125-
// `logger` is null, then it defaults to a logger that inserts into
126-
// `std::cerr`.
125+
// `logger` is null, then it defaults to no logging (`NullLogger`). See
126+
// `CerrLogger` for an alternative.
127127
std::shared_ptr<Logger> logger;
128128

129129
// `log_on_startup` indicates whether the tracer will log a banner of

test/test_cerr_logger.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class StreambufGuard {
2929

3030
} // namespace
3131

32-
// `CerrLogger` is the default logger.
33-
// These test exist just to cover all of its methods.
3432
TEST_CASE("CerrLogger") {
3533
std::ostringstream stream;
3634
const StreambufGuard guard{std::cerr, stream.rdbuf()};

0 commit comments

Comments
 (0)