Skip to content

Commit

Permalink
pw_log: Remove unused macro PW_MODULE_LOG_NAME_DEFINED
Browse files Browse the repository at this point in the history
PW_MODULE_LOG_NAME_DEFINED is problematic because PW_LOG_MODULE_NAME can
be overridden after the default is defined. It also behaves unexpectedly
if PW_LOG_MODULE_NAME is manually set to "".

Change-Id: I4e047bad3b7c6735e29e03896cedcb3c38f63877
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/238554
Presubmit-Verified: CQ Bot Account <[email protected]>
Reviewed-by: Taylor Cramer <[email protected]>
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
Lint: Lint 🤖 <[email protected]>
Commit-Queue: Wyatt Hepler <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Sep 28, 2024
1 parent 77f7b45 commit 5d9a1e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
4 changes: 1 addition & 3 deletions pw_log/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ source files, not headers. For example:
.. c:macro:: PW_LOG_MODULE_NAME
A string literal module name to use in logs. Log backends may attach this
name to log messages or use it for runtime filtering. Defaults to ``""``. The
``PW_LOG_MODULE_NAME_DEFINED`` macro is set to ``1`` or ``0`` to indicate
whether ``PW_LOG_MODULE_NAME`` was overridden.
name to log messages or use it for runtime filtering. Defaults to ``""``.

.. c:macro:: PW_LOG_FLAGS
Expand Down
11 changes: 2 additions & 9 deletions pw_log/public/pw_log/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,9 @@

// Default: Module name
//
// An empty string is used for the module name if it is not set. The
// PW_LOG_MODULE_NAME_DEFINED macro is set to 1 or 0 to allow pw_log backends to
// behave differently if the module name is defined. For example, a backend
// might prefix the format string with PW_LOG_MODULE_NAME ": ", but only if the
// module name is provided.
#ifdef PW_LOG_MODULE_NAME
#define PW_LOG_MODULE_NAME_DEFINED 1
#else
// An empty string is used for the module name if it is not set.
#ifndef PW_LOG_MODULE_NAME
#define PW_LOG_MODULE_NAME ""
#define PW_LOG_MODULE_NAME_DEFINED 0
#endif // PW_LOG_MODULE_NAME

// Default: Log level filtering
Expand Down

0 comments on commit 5d9a1e8

Please sign in to comment.