summaryrefslogtreecommitdiff
path: root/include/ibm/utils.hpp
AgeCommit message (Collapse)AuthorFilesLines
2023-07-20Replace logging with std::formatEd Tanous1-4/+4
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging. Unfortunately, given its level of compile time checks, it needs to be a method, instead of the stream style logging we had before. This requires a pretty substantial change. Fortunately, this change can be largely automated, via the script included in this commit under scripts/replace_logs.py. This is to aid people in moving their patchsets over to the new form in the short period where old patches will be based on the old logging. The intention is that this script eventually goes away. The old style logging (stream based) looked like. BMCWEB_LOG_DEBUG << "Foo " << foo; The new equivalent of the above would be: BMCWEB_LOG_DEBUG("Foo {}", foo); In the course of doing this, this also cleans up several ignored linter errors, including macro usage, and array to pointer deconstruction. Note, This patchset does remove the timestamp from the log message. In practice, this was duplicated between journald and bmcweb, and there's no need for both to exist. One design decision of note is the addition of logPtr. Because the compiler can't disambiguate between const char* and const MyThing*, it's necessary to add an explicit cast to void*. This is identical to how fmt handled it. Tested: compiled with logging meson_option enabled, and launched bmcweb Saw the usual logging, similar to what was present before: ``` [Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled [Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800 [Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist [Info src/webserver_main.cpp:59] Starting webserver on port 18080 [Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file. [Info src/webserver_main.cpp:137] Start Hostname Monitor Service... ``` Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
2023-02-24Pass string views by valueEd Tanous1-1/+1
string_view should always be passed by value; This commit is a sed replace of the code to make all string_views pass by value, per general coding guidelines[1]. [1] https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/ Tested: Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I55b342a29a0fbfce0a4ed9ea63db6014d03b134c
2023-01-18Fix a boatload of #includesEd Tanous1-1/+1
Most of these missing includes were found by running clang-tidy on all files, including headers. The existing scripts just run clang-tidy on source files, which doesn't catch most of these. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic741fbb2cc9e5e92955fd5a1b778a482830e80e8
2021-04-20Create IBM ConfigFile base directorySunitha Harish1-0/+43
The ConfigFile upload fails when the /var/lib/obmc directory is not available at BMC This commit changes the base directory to /var/lib/bmcweb The subdirectories for the configfiles and locks are created under this new path Migration strategy of this directory and files: This is IBM only feature, compiled under the IBM_MANAGEMENT_CONSOLE flag There is no system out yet which is running this code Internal IBM stake holders are in agreement with the changes Tested by : 1. Tested configfile upload on a BMC where the base directory is not available 2. Tested the configfile upload on a factory BMC. Verified it creates the base directories and the upload is successful 3. Tested the configfile usecases for delete and delete-all 4. Tested the acquire-lock functionality 5. Ran lock unit test successfully Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: Ic3f5f5d0ba0b37950fd397ec835b4fa7babdaa9b