logging.hpp (c8491cb0b416637f1c1119c3f0d95500a4bd9c29) logging.hpp (ea5e22424e00d9134556a966fe4c2a28dcbb94dc)
1#pragma once
2
3#include "bmcweb_config.h"
4
5#include <bit>
6#include <format>
7#include <iostream>
8#include <source_location>

--- 63 unchanged lines hidden (view full) ---

72 {
73 return;
74 }
75 constexpr size_t stringIndex = static_cast<size_t>(level);
76 static_assert(stringIndex < mapLogLevelFromName.size(),
77 "Missing string for level");
78 constexpr std::string_view levelString = mapLogLevelFromName[stringIndex];
79 std::string_view filename = loc.file_name();
1#pragma once
2
3#include "bmcweb_config.h"
4
5#include <bit>
6#include <format>
7#include <iostream>
8#include <source_location>

--- 63 unchanged lines hidden (view full) ---

72 {
73 return;
74 }
75 constexpr size_t stringIndex = static_cast<size_t>(level);
76 static_assert(stringIndex < mapLogLevelFromName.size(),
77 "Missing string for level");
78 constexpr std::string_view levelString = mapLogLevelFromName[stringIndex];
79 std::string_view filename = loc.file_name();
80 filename = filename.substr(filename.rfind('/') + 1);
80 filename = filename.substr(filename.rfind('/'));
81 if (!filename.empty())
82 {
83 filename.remove_prefix(1);
84 }
81 std::string logLocation;
82 try
83 {
84 // TODO, multiple static analysis tools flag that this could potentially
85 // throw Based on the documentation, it shouldn't throw, so long as none
86 // of the formatters throw, so unclear at this point why this try/catch
87 // is required, but add it to silence the static analysis tools.
88 logLocation = std::format("[{} {}:{}] ", levelString, filename,

--- 101 unchanged lines hidden ---
85 std::string logLocation;
86 try
87 {
88 // TODO, multiple static analysis tools flag that this could potentially
89 // throw Based on the documentation, it shouldn't throw, so long as none
90 // of the formatters throw, so unclear at this point why this try/catch
91 // is required, but add it to silence the static analysis tools.
92 logLocation = std::format("[{} {}:{}] ", levelString, filename,

--- 101 unchanged lines hidden ---