regulators: Delete journal.cpp and mock_journal.cpp

Delete the file journal.cpp, it is no longer needed.

Delete the file mock_journal.cpp, it is no longer needed.

Delete log() method in exception_utils.cpp, it is no longer
needed.

Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: Ifb9d3524f2b9c7f9b266e03ef52e1cba0a49c08d
diff --git a/phosphor-regulators/src/exception_utils.cpp b/phosphor-regulators/src/exception_utils.cpp
index dc7f9b7..6f237e6 100644
--- a/phosphor-regulators/src/exception_utils.cpp
+++ b/phosphor-regulators/src/exception_utils.cpp
@@ -26,15 +26,6 @@
     return messages;
 }
 
-void log(const std::exception& e)
-{
-    std::vector<std::string> messages = getMessages(e);
-    for (const std::string& message : messages)
-    {
-        journal::logErr(message);
-    }
-}
-
 namespace internal
 {
 
diff --git a/phosphor-regulators/src/exception_utils.hpp b/phosphor-regulators/src/exception_utils.hpp
index 825b155..81d700b 100644
--- a/phosphor-regulators/src/exception_utils.hpp
+++ b/phosphor-regulators/src/exception_utils.hpp
@@ -42,18 +42,6 @@
  */
 std::vector<std::string> getMessages(const std::exception& e);
 
-/**
- * Logs the specified exception to the systemd journal.
- *
- * Gets the error messages from the specified exception and any nested inner
- * exceptions.
- *
- * Logs each error message to the journal with a priority value of 'ERR'.
- *
- * @param e exception
- */
-void log(const std::exception& e);
-
 /*
  * Internal implementation details
  */
diff --git a/phosphor-regulators/src/journal.cpp b/phosphor-regulators/src/journal.cpp
deleted file mode 100644
index 9a50e1e..0000000
--- a/phosphor-regulators/src/journal.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright © 2020 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "journal.hpp"
-
-#include <phosphor-logging/log.hpp>
-
-using namespace phosphor::logging;
-
-/**
- * This is the standard implementation of the journal interface.  It calls
- * phosphor-logging functions to create real systemd journal entries.
- *
- * Testcases should link with the file mock_journal.cpp instead.
- */
-namespace phosphor::power::regulators::journal
-{
-
-void logErr(const std::string& message)
-{
-    log<level::ERR>(message.c_str());
-}
-
-void logInfo(const std::string& message)
-{
-    log<level::INFO>(message.c_str());
-}
-
-void logDebug(const std::string& message)
-{
-    log<level::DEBUG>(message.c_str());
-}
-
-} // namespace phosphor::power::regulators::journal
diff --git a/phosphor-regulators/src/journal.hpp b/phosphor-regulators/src/journal.hpp
index 0684830..47dc347 100644
--- a/phosphor-regulators/src/journal.hpp
+++ b/phosphor-regulators/src/journal.hpp
@@ -150,45 +150,3 @@
 };
 
 } // namespace phosphor::power::regulators
-
-// TODO: Remove the functional interface below once all the code has switched to
-// the new Journal interface.  Also delete journal.cpp and remove references to
-// it in meson files.
-
-/**
- * Systemd journal interface.
- *
- * Provides functions to log messages to the systemd journal.
- *
- * This interface provides an abstraction layer so that testcases can use a mock
- * implementation and validate the logged messages.
- *
- * This interface does not currently provide the ability to specify key/value
- * pairs to provide more information in the journal entry.  It will be added
- * later if needed.
- */
-namespace phosphor::power::regulators::journal
-{
-
-/**
- * Logs a message with a priority value of 'ERR' to the systemd journal.
- *
- * @param message message to log
- */
-void logErr(const std::string& message);
-
-/**
- * Logs a message with a priority value of 'INFO' to the systemd journal.
- *
- * @param message message to log
- */
-void logInfo(const std::string& message);
-
-/**
- * Logs a message with a priority value of 'DEBUG' to the systemd journal.
- *
- * @param message message to log
- */
-void logDebug(const std::string& message);
-
-} // namespace phosphor::power::regulators::journal
diff --git a/phosphor-regulators/src/meson.build b/phosphor-regulators/src/meson.build
index b6b500c..ed22808 100644
--- a/phosphor-regulators/src/meson.build
+++ b/phosphor-regulators/src/meson.build
@@ -43,7 +43,6 @@
 phosphor_regulators = executable(
     'phosphor-regulators',
     'interfaces/manager_interface.cpp',
-    'journal.cpp',
     'main.cpp',
     'manager.cpp',
     dependencies: [
diff --git a/phosphor-regulators/test/exception_utils_tests.cpp b/phosphor-regulators/test/exception_utils_tests.cpp
index 6d0c4cc..0d950ef 100644
--- a/phosphor-regulators/test/exception_utils_tests.cpp
+++ b/phosphor-regulators/test/exception_utils_tests.cpp
@@ -49,31 +49,6 @@
     }
 }
 
-TEST(ExceptionUtilsTests, Log)
-{
-    try
-    {
-        try
-        {
-            throw std::invalid_argument{"JSON element is not an array"};
-        }
-        catch (...)
-        {
-            std::throw_with_nested(
-                std::logic_error{"Unable to parse config file"});
-        }
-    }
-    catch (const std::exception& e)
-    {
-        journal::clear();
-        exception_utils::log(e);
-        const std::vector<std::string>& messages = journal::getErrMessages();
-        EXPECT_EQ(messages.size(), 2);
-        EXPECT_EQ(messages[0], "JSON element is not an array");
-        EXPECT_EQ(messages[1], "Unable to parse config file");
-    }
-}
-
 // Test for getMessages() function in the internal namespace
 TEST(ExceptionUtilsTests, GetMessagesInternal)
 {
diff --git a/phosphor-regulators/test/meson.build b/phosphor-regulators/test/meson.build
index 74681f6..b36ff1a 100644
--- a/phosphor-regulators/test/meson.build
+++ b/phosphor-regulators/test/meson.build
@@ -13,7 +13,6 @@
     'exception_utils_tests.cpp',
     'ffdc_file_tests.cpp',
     'id_map_tests.cpp',
-    'mock_journal.cpp',
     'pmbus_error_tests.cpp',
     'pmbus_utils_tests.cpp',
     'presence_detection_tests.cpp',
diff --git a/phosphor-regulators/test/mock_journal.cpp b/phosphor-regulators/test/mock_journal.cpp
deleted file mode 100644
index e5c8ab9..0000000
--- a/phosphor-regulators/test/mock_journal.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright © 2020 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "mock_journal.hpp"
-
-/**
- * This is the mock implementation of the journal interface.  It just stores the
- * journal messages in static vectors.
- *
- * Executables that need to log real systemd journal messages should link with
- * the file journal.cpp instead.
- */
-namespace phosphor::power::regulators::journal
-{
-
-/**
- * Mock journal messages with a priority value of 'ERR'.
- */
-static std::vector<std::string> errMessages{};
-
-/**
- * Mock journal messages with a priority value of 'INFO'.
- */
-static std::vector<std::string> infoMessages{};
-
-/**
- * Mock journal messages with a priority value of 'DEBUG'.
- */
-static std::vector<std::string> debugMessages{};
-
-void clear()
-{
-    errMessages.clear();
-    infoMessages.clear();
-    debugMessages.clear();
-}
-
-const std::vector<std::string>& getErrMessages()
-{
-    return errMessages;
-}
-
-const std::vector<std::string>& getInfoMessages()
-{
-    return infoMessages;
-}
-
-const std::vector<std::string>& getDebugMessages()
-{
-    return debugMessages;
-}
-
-void logErr(const std::string& message)
-{
-    errMessages.emplace_back(message);
-}
-
-void logInfo(const std::string& message)
-{
-    infoMessages.emplace_back(message);
-}
-
-void logDebug(const std::string& message)
-{
-    debugMessages.emplace_back(message);
-}
-
-} // namespace phosphor::power::regulators::journal
diff --git a/phosphor-regulators/test/mock_journal.hpp b/phosphor-regulators/test/mock_journal.hpp
index 6fe93bc..d1ebe0b 100644
--- a/phosphor-regulators/test/mock_journal.hpp
+++ b/phosphor-regulators/test/mock_journal.hpp
@@ -53,44 +53,3 @@
 };
 
 } // namespace phosphor::power::regulators
-
-// TODO: Remove the functional interface below once all the code has switched to
-// the new Journal interface.  Also delete mock_journal.cpp and remove
-// references to it in meson files.
-
-/**
- * Extensions to the systemd journal interface.
- *
- * Provides functions to access and clear mock journal messages that have been
- * logged.  These functions should only be used by testcases.
- */
-namespace phosphor::power::regulators::journal
-{
-
-/**
- * Clears all mock journal messages.
- */
-void clear();
-
-/**
- * Returns all mock journal messages with a priority value of 'ERR'.
- *
- * @return mock error messages
- */
-const std::vector<std::string>& getErrMessages();
-
-/**
- * Returns all mock journal messages with a priority value of 'INFO'.
- *
- * @return mock informational messages
- */
-const std::vector<std::string>& getInfoMessages();
-
-/**
- * Returns all mock journal messages with a priority value of 'DEBUG'.
- *
- * @return mock debug messages
- */
-const std::vector<std::string>& getDebugMessages();
-
-} // namespace phosphor::power::regulators::journal