Skip to content

Commit

Permalink
fix logging: make variable const-correct
Browse files Browse the repository at this point in the history
Detected with clang-tidy:

```
<hidden by NDA>: error: variable 'module' of type '::logging::Module' can be declared 'const' [misc-const-correctness,-warnings-as-errors]
    LOG_DEBUG() << "<hidden by NDA>";
    ^
<hidden by NDA>/universal/include/userver/logging/log.hpp:270:52: note: expanded from macro 'LOG_DEBUG'
#define LOG_DEBUG() USERVER_IMPL_LOGS_DEBUG_ERASER(LOG(USERVER_NAMESPACE::logging::Level::kDebug))
                                                   ^
<hidden by NDA>/universal/include/userver/logging/log.hpp:260:18: note: expanded from macro 'LOG'
#define LOG(lvl) LOG_TO(USERVER_NAMESPACE::logging::GetDefaultLogger(), (lvl))
                 ^
<hidden by NDA>/universal/include/userver/logging/log.hpp:254:11: note: expanded from macro 'LOG_TO'
        : USERVER_IMPL_LOG_TO((logger), (lvl))
          ^
<hidden by NDA>/universal/include/userver/logging/log.hpp:225:13: note: expanded from macro 'USERVER_IMPL_LOG_TO'
            static USERVER_NAMESPACE::logging::Module module(location);         \
            ^
```

Tests: CI
commit_hash:76344878157d5c5388ec39739195ee2c7e0762dc
  • Loading branch information
TTPO100AJIEX committed Jan 24, 2025
1 parent a9705d4 commit 81200d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion universal/include/userver/logging/log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct EntryStorage final {
logger, \
level, \
[](const auto& location) -> const USERVER_NAMESPACE::logging::Module& { \
static USERVER_NAMESPACE::logging::Module module(location); \
static const USERVER_NAMESPACE::logging::Module module(location); \
return module; \
}(USERVER_NAMESPACE::utils::impl::SourceLocation::Current()), \
USERVER_NAMESPACE::logging::LogClass::kLog \
Expand Down

0 comments on commit 81200d8

Please sign in to comment.