Skip to content

Commit

Permalink
Make chip::Logging::GetModuleName public (#26664)
Browse files Browse the repository at this point in the history
* Make chip::Logging::GetModuleName public

Problem:
- Platform LogV receives the module name string
- To make any choices based on module, the module names
  must be visible
- Somehow the module names getter was not public

This PR:
- Make the function public (no functional change)

Testing done:
- Still builds, unit tests pass

* Restyled by clang-format

---------

Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Feb 6, 2024
1 parent 3848a95 commit 1067836
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/support/logging/CHIPLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ static const char ModuleNames[kLogModule_Max][kMaxModuleNameLen + 1] = {
"CSM", // CASESessionManager
};

static char const * GetModuleName(LogModule module)
} // namespace

const char * GetModuleName(LogModule module)
{
return ModuleNames[(module < kLogModule_Max) ? module : kLogModule_NotSpecified];
}

} // namespace

void SetLogRedirectCallback(LogRedirectCallback_t callback)
{
sLogRedirectCallback.store(callback);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/support/logging/CHIPLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ using ByteSpan = Span<const uint8_t>;

namespace Logging {

// Get the module name associated with a LogModule, or "-" on invalid value.
const char * GetModuleName(LogModule module);

// Log redirection
using LogRedirectCallback_t = void (*)(const char * module, uint8_t category, const char * msg, va_list args);
DLL_EXPORT void SetLogRedirectCallback(LogRedirectCallback_t callback);
Expand Down

0 comments on commit 1067836

Please sign in to comment.