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
کامیت شده توسط GitHub
والد 5e4dd502d9
کامیت 41c0ddd72d
38فایلهای تغییر یافته به همراه193 افزوده شده و 152 حذف شده
@@ -139,7 +139,7 @@ flush(rocprofiler_buffer_id_t buffer_id, bool wait)
{
if(registration::get_fini_status() > 0)
{
LOG(ERROR) << "ignoring rocprofiler buffer flush (handle=" << buffer_id.handle
ROCP_ERROR << "ignoring rocprofiler buffer flush (handle=" << buffer_id.handle
<< ") request after finalization";
return ROCPROFILER_STATUS_ERROR_FINALIZED;
}
@@ -202,14 +202,14 @@ flush(rocprofiler_buffer_id_t buffer_id, bool wait)
}
} catch(std::exception& e)
{
LOG(ERROR) << "buffer callback threw an exception: " << e.what();
ROCP_ERROR << "buffer callback threw an exception: " << e.what();
}
// clear the buffer
buff_internal_v.clear();
}
else
{
LOG(INFO) << "buffer at " << buffer_id.handle << " is empty...";
ROCP_INFO << "buffer at " << buffer_id.handle << " is empty...";
}
buff_v->syncer.clear();
@@ -242,7 +242,7 @@ rocprofiler_create_buffer(rocprofiler_context_id_t context,
auto* existing_buff = rocprofiler::buffer::get_buffer(*buffer_id);
if(existing_buff)
{
LOG(ERROR) << "buffer (handle=" << buffer_id->handle
ROCP_ERROR << "buffer (handle=" << buffer_id->handle
<< ") already allocated: handle=" << existing_buff->buffer_id;
return ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED;
}