Fix chip_logging=false builds. (#29878)

Fixes https://github.com/project-chip/connectedhomeip/issues/29877
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 5412d29..902c7af 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -85,18 +85,22 @@
             # - name: Upload Code Coverage
             #   if: ${{ contains('main', env.BUILD_TYPE) }}
             #   run: bash <(curl -s https://codecov.io/bash)
-            - name: Setup Build Without Detail Logging
+            - name: Set up Build Without Detail Logging
               run: scripts/build/gn_gen.sh --args="chip_detail_logging=false"
             - name: Run Build Without Detail Logging
               run: scripts/run_in_build_env.sh "ninja -C ./out"
-            - name: Setup Build Without Progress Logging
+            - name: Set up Build Without Progress Logging
               run: scripts/build/gn_gen.sh --args="chip_detail_logging=false chip_progress_logging=false"
             - name: Run Build Without Progress Logging
               run: scripts/run_in_build_env.sh "ninja -C ./out"
-            - name: Setup Build Without Error Logging
+            - name: Set up Build Without Error Logging
               run: scripts/build/gn_gen.sh --args="chip_detail_logging=false chip_progress_logging=false chip_error_logging=false"
             - name: Run Build Without Error Logging
               run: scripts/run_in_build_env.sh "ninja -C ./out"
+            - name: Set up Build Without Logging
+              run: scripts/build/gn_gen.sh --args="chip_logging=false"
+            - name: Run Build Without Logging
+              run: scripts/run_in_build_env.sh "ninja -C ./out"
             - name: Uploading core files
               uses: actions/upload-artifact@v3
               if: ${{ failure() && !env.ACT }}
diff --git a/examples/chip-tool/commands/clusters/JsonParser.h b/examples/chip-tool/commands/clusters/JsonParser.h
index adb1375..9f13c3b 100644
--- a/examples/chip-tool/commands/clusters/JsonParser.h
+++ b/examples/chip-tool/commands/clusters/JsonParser.h
@@ -130,6 +130,7 @@
 private:
     static void LogErrorLocation(chip::Optional<unsigned> & errorColumn, const char * json)
     {
+#if CHIP_ERROR_LOGGING
         if (!errorColumn.HasValue())
         {
             return;
@@ -160,5 +161,6 @@
         errorMarker += "^";
         ChipLogError(chipTool, "%s", errorMarker.c_str());
         errorColumn.ClearValue();
+#endif // CHIP_ERROR_LOGGING
     }
 };
diff --git a/src/lib/support/logging/TextOnlyLogging.cpp b/src/lib/support/logging/TextOnlyLogging.cpp
index 738f4c8..1e57394 100644
--- a/src/lib/support/logging/TextOnlyLogging.cpp
+++ b/src/lib/support/logging/TextOnlyLogging.cpp
@@ -221,20 +221,6 @@
     gLogFilter = category;
 }
 
-#else  // CHIP_LOG_FILTERING
-
-uint8_t GetLogFilter()
-{
-    return kLogCategory_Max;
-}
-
-void SetLogFilter(uint8_t category)
-{
-    IgnoreUnusedVariable(category);
-}
-#endif // CHIP_LOG_FILTERING
-
-#if CHIP_LOG_FILTERING
 bool IsCategoryEnabled(uint8_t category)
 {
     return (category <= gLogFilter);
diff --git a/src/lib/support/logging/TextOnlyLogging.h b/src/lib/support/logging/TextOnlyLogging.h
index a59946c..d6b22f7 100644
--- a/src/lib/support/logging/TextOnlyLogging.h
+++ b/src/lib/support/logging/TextOnlyLogging.h
@@ -79,16 +79,8 @@
 
 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);
-
-// Log filtering (no-op unless CHIP_LOG_FILTERING is enabled)
-DLL_EXPORT uint8_t GetLogFilter();
-DLL_EXPORT void SetLogFilter(uint8_t category);
 
 #if CHIP_ERROR_LOGGING
 /**
@@ -323,18 +315,34 @@
 #define _CHIP_USE_LOGGING 0
 #endif // CHIP_ERROR_LOGGING || CHIP_PROGRESS_LOGGING || CHIP_DETAIL_LOGGING || CHIP_AUTOMATION_LOGGING
 
-#if _CHIP_USE_LOGGING
-
-static constexpr uint16_t kMaxModuleNameLen = 3;
-
-#if CHIP_LOG_FILTERING
+// Log filtering (no-op unless CHIP_LOG_FILTERING is enabled)
+#if _CHIP_USE_LOGGING && CHIP_LOG_FILTERING
+DLL_EXPORT uint8_t GetLogFilter();
+DLL_EXPORT void SetLogFilter(uint8_t category);
 bool IsCategoryEnabled(uint8_t category);
-#else  // CHIP_LOG_FILTERING
+#else  // _CHIP_USE_LOGGING && CHIP_LOG_FILTERING
+inline uint8_t GetLogFilter()
+{
+    return kLogCategory_Max;
+}
+
+inline void SetLogFilter(uint8_t category) {}
+
 inline bool IsCategoryEnabled(uint8_t category)
 {
     return true;
 }
-#endif // CHIP_LOG_FILTERING
+#endif // _CHIP_USE_LOGGING && CHIP_LOG_FILTERING
+
+#if _CHIP_USE_LOGGING
+
+// Get the module name associated with a LogModule, or "-" on invalid value.
+const char * GetModuleName(LogModule module);
+
+// Log redirection
+DLL_EXPORT void SetLogRedirectCallback(LogRedirectCallback_t callback);
+
+static constexpr uint16_t kMaxModuleNameLen = 3;
 
 /* Internal macros mapping upper case definitions to camel case category constants*/
 #define CHIP_LOG_CATEGORY_DETAIL chip::Logging::kLogCategory_Detail
@@ -427,6 +435,10 @@
     } while (0)
 #endif // CHIP_PW_TOKENIZER_LOGGING
 
+#else // _CHIP_USE_LOGGING
+
+inline void SetLogRedirectCallback(LogRedirectCallback_t callback) {}
+
 #endif // _CHIP_USE_LOGGING
 
 } // namespace Logging