Convert LOG() -> ROCP_X logging macros. (#695)

* Convert LOG() -> ROCP_X logging macros.

This patch converts the LOG() macro to the ROCP_X logging macros.
There are the following levels of logs.

Logs whos expressions are not evaluated unless the log level is enabled:

ROCP_TRACE - VLOG(2) (enabeled by env variable GLOG_v=2)
ROCP_INFO - VLOG(1) (enabeled by env variable GLOG_v=1)

Logs whos expressions are always evaluated:

ROCP_WARNING - LOG(WARNING)
ROCP_ERROR - LOG(ERROR)
ROCP_FATAL - LOG(FATAL)
ROCP_DFATAL - DLOG(FATAL) (only fatal in debug mode)

* source formatting (clang-format v11) (#696)

Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com>

* Minor fix

* Fixes for VLOG before main

* fix vmodule

* source formatting (clang-format v11) (#718)

Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com>

* memory leak fix

* Vlog change

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com>
This commit is contained in:
Benjamin Welton
2024-04-02 17:15:30 -07:00
committed by GitHub
orang tua 5e4dd502d9
melakukan 41c0ddd72d
38 mengubah file dengan 193 tambahan dan 152 penghapusan
@@ -22,6 +22,7 @@
#include "output_file.hpp"
#include "config.hpp"
#include "lib/common/logging.hpp"
#include <fmt/format.h>
@@ -57,7 +58,7 @@ get_output_stream(const std::string& fname, const std::string& ext)
if(!_ofs && !*_ofs)
throw std::runtime_error{fmt::format("Failed to open {} for output", output_file)};
LOG(ERROR) << "Opened result file: " << output_file;
ROCP_ERROR << "Opened result file: " << output_file;
return {_ofs, [](std::ostream*& v) {
if(v) dynamic_cast<std::ofstream*>(v)->close();
@@ -69,9 +70,9 @@ get_output_stream(const std::string& fname, const std::string& ext)
output_file::~output_file()
{
if(m_stream)
LOG(INFO) << "Closing result file: " << m_name;
ROCP_INFO << "Closing result file: " << m_name;
else
LOG(WARNING) << "output_file::~output_file does not have a output stream instance!";
ROCP_WARNING << "output_file::~output_file does not have a output stream instance!";
m_dtor(m_stream);
}