Add debug mode

Description:
    1. Could enable debug mode by adding file: /etc/thermal.d/debugging.
        $ mkdir /etc/thermal.d
        $ touch /etc/thermal.d/debugging
        $ systemctl restart phosphor-pid-control

    2. Could record fans output PWM, chosen temperature, PID/stepwise output PWM in debug mode.

Design:
    1. Create debugging file and restart service to enable debug mode.

    2. Check if debug mode is enabled to output fans output PWM, chosen temperature,
       PID/stepwise output PWM, and so on.

Test Case:
    1. Enable debug mode and check logs: pass

Change-Id: I8527ebcb81e723298ba7e786b4501f986ebd439e
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
diff --git a/main.cpp b/main.cpp
index 796c066..8ae6be5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -244,6 +244,7 @@
     loggingPath = "";
     loggingEnabled = false;
     tuningEnabled = false;
+    debugEnabled = false;
 
     CLI::App app{"OpenBMC Fan Control Daemon"};
 
@@ -254,11 +255,13 @@
                    "Optional parameter to specify logging folder")
         ->check(CLI::ExistingDirectory);
     app.add_flag("-t,--tuning", tuningEnabled, "Enable or disable tuning");
+    app.add_flag("-d,--debug", debugEnabled, "Enable or disable debug mode");
 
     CLI11_PARSE(app, argc, argv);
 
     static constexpr auto loggingEnablePath = "/etc/thermal.d/logging";
     static constexpr auto tuningEnablePath = "/etc/thermal.d/tuning";
+    static constexpr auto debugEnablePath = "/etc/thermal.d/debugging";
 
     // Set up default logging path, preferring command line if it was given
     std::string defLoggingPath(loggingPath);
@@ -306,6 +309,17 @@
         std::cerr << "Tuning enabled\n";
     }
 
+    // If this file exists, enable debug mode at runtime
+    if (std::filesystem::exists(debugEnablePath))
+    {
+        debugEnabled = true;
+    }
+
+    if (debugEnabled)
+    {
+        std::cerr << "Debug mode enabled\n";
+    }
+
     static constexpr auto modeRoot = "/xyz/openbmc_project/settings/fanctrl";
     // Create a manager for the ModeBus because we own it.
     sdbusplus::server::manager_t(static_cast<sdbusplus::bus_t&>(modeControlBus),