Commit 8e6cf78a authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

vtkLogger: rename `f` suffix to `F` to avoid confusion.

parent a934322b
......@@ -33,22 +33,22 @@ void log_handler(void* user_data, const vtkLogger::Message& message)
int TestLogger(int, char* [])
{
std::string lines;
vtkLogf(INFO, "changing verbosity to %d", vtkLogger::VERBOSITY_TRACE);
vtkLogF(INFO, "changing verbosity to %d", vtkLogger::VERBOSITY_TRACE);
vtkLogger::AddCallback("sonnet-grabber", log_handler, &lines, vtkLogger::VERBOSITY_2);
vtkLogger::SetStderrVerbosity(vtkLogger::VERBOSITY_TRACE);
vtkLogScopeFunction(TRACE);
{
vtkLogScopef(TRACE, "Sonnet 18");
vtkLogScopeF(TRACE, "Sonnet 18");
auto whom = "thee";
vtkLog(2, "Shall I compare " << whom << " to a summer's day?");
auto what0 = "lovely";
auto what1 = "temperate";
vtkLogf(2, "Thou art more %s and more %s:", what0, what1);
vtkLogF(2, "Thou art more %s and more %s:", what0, what1);
auto month = "May";
vtkLogIf(2, true, << "Rough winds do shake the darling buds of " << month << ",");
vtkLogIff(2, true, "And %s’s lease hath all too short a date;", "summers");
vtkLogIfF(2, true, "And %s’s lease hath all too short a date;", "summers");
}
cerr << "--------------------------------------------" << endl
......@@ -65,7 +65,7 @@ int TestLogger(int, char* [])
{
vtkLogStartScope(INFO, "scope-0");
}
vtkLogStartScopef(INFO, "scope-1", "scope %d", 1);
vtkLogStartScopeF(INFO, "scope-1", "scope %d", 1);
vtkLog(INFO, "some text");
vtkLogEndScope("scope-1");
{
......
......@@ -265,7 +265,7 @@ void vtkLogger::Log(vtkLogger::Verbosity verbosity,
}
//----------------------------------------------------------------------------
void vtkLogger::Logf(vtkLogger::Verbosity verbosity,
void vtkLogger::LogF(vtkLogger::Verbosity verbosity,
const char* fname,
unsigned int lineno,
const char* format,
......@@ -314,7 +314,7 @@ void vtkLogger::EndScope(const char* id)
}
//----------------------------------------------------------------------------
void vtkLogger::StartScopef(Verbosity verbosity, const char* id, const char* fname,
void vtkLogger::StartScopeF(Verbosity verbosity, const char* id, const char* fname,
unsigned int lineno, const char* format, ...)
{
#if VTK_ENABLE_LOGGING
......
......@@ -53,7 +53,7 @@
*
* vtkLogger provides several macros (again, based on `loguru`) that can be
* used to add the log. Both printf-style and stream-style is supported. All
* printf-style macros are suffixed with `f` to distinguish them from the stream
* printf-style macros are suffixed with `F` to distinguish them from the stream
* macros. Another pattern in naming macros is the presence of `V`
* e.g. `vtkVLog` vs `vtkLog`. A macro with the `V` prefix takes a fully
* qualified verbosity enum e.g. `vtkLogger::VERBOSITY_INFO` or
......@@ -80,32 +80,32 @@
* vtkLogger::SetStderrVerbosity(vtkLogger::VERBOSITY_1);
*
* // add a line to log using the verbosity name.
* vtkLogf(INFO, "I'm hungry for some %.3f!", 3.14159);
* vtkLogf(0, "same deal");
* vtkLogF(INFO, "I'm hungry for some %.3f!", 3.14159);
* vtkLogF(0, "same deal");
*
* // add a line to log using the verbosity enum.
* vtkVLogf(vtkLogger::VERBOSITY_INFO, "I'm hungry for some %.3f!", 3.14159);
* vtkVLogf(vtkLogger::VERBOSITY_0, "same deal");
* vtkVLogF(vtkLogger::VERBOSITY_INFO, "I'm hungry for some %.3f!", 3.14159);
* vtkVLogF(vtkLogger::VERBOSITY_0, "same deal");
*
* // to add a indentifier for a vtkObjectBase or subclass
* vtkLogf(INFO, "The object is %s", vtkLogIdentifier(vtkobject));
* vtkLogF(INFO, "The object is %s", vtkLogIdentifier(vtkobject));
*
* // add a line conditionally to log if the condition fails:
* vtkLogIff(INFO, ptr != nullptr, "ptr is nullptr (some number: %.3f)", * 3.14159);
* vtkLogIfF(INFO, ptr != nullptr, "ptr is nullptr (some number: %.3f)", * 3.14159);
*
* vtkLogScopef(INFO, "Will indent all log messages within this scope.");
* vtkLogScopeF(INFO, "Will indent all log messages within this scope.");
* // in a function, you may use vtkLogScopeFunction(INFO)
*
* // scope can be explicitly started and closed by vtkLogStartScope (or
* // vtkLogStartScopef) and vtkLogEndScope
* vtkLogStartScope(INFO, "id-used-as-message");
* vtkLogStartScopef(INFO, "id", "message-%d", 1);
* vtkLogStartScopeF(INFO, "id", "message-%d", 1);
* vtkLogEndScope("id");
* vtkLogEndScope("id-used-as-message");
*
* // alternatively, you can use streams instead of printf-style
* vtkLog(INFO, "I'm hungry for some " << 3.14159 << "!");
* vtkLogIf(INFO, ptr != nullptr, "ptr is " << "nullptr");
* vtkLogIF(INFO, ptr != nullptr, "ptr is " << "nullptr");
*
* @endcode
*
......@@ -369,9 +369,9 @@ public:
Verbosity verbosity, const char* id, const char* fname, unsigned int lineno);
static void EndScope(const char* id);
#if !defined(__WRAP__)
static void Logf(Verbosity verbosity, const char* fname, unsigned int lineno,
static void LogF(Verbosity verbosity, const char* fname, unsigned int lineno,
VTK_FORMAT_STRING_TYPE format, ...) VTK_PRINTF_LIKE(4, 5);
static void StartScopef(Verbosity verbosity, const char* id, const char* fname,
static void StartScopeF(Verbosity verbosity, const char* id, const char* fname,
unsigned int lineno, VTK_FORMAT_STRING_TYPE format, ...) VTK_PRINTF_LIKE(5, 6);
class VTKCOMMONCORE_EXPORT LogScopeRAII
......@@ -416,19 +416,19 @@ private:
* or higher.
*
* // using printf-style
* vtkLogf(INFO, "Hello %s", "world!");
* vtkVLogf(vtkLogger::VERBOSITY_INFO, "Hello %s", "world!");
* vtkLogF(INFO, "Hello %s", "world!");
* vtkVLogF(vtkLogger::VERBOSITY_INFO, "Hello %s", "world!");
*
* // using streams
* vtkLog(INFO, "Hello " << "world!");
* vtkVLog(vtkLogger::VERBOSITY_INFO, << "Hello world!");
*
*/
#define vtkVLogf(level, ...) \
#define vtkVLogF(level, ...) \
((level) > vtkLogger::GetCurrentVerbosityCutoff()) \
? (void)0 \
: vtkLogger::Logf(level, __FILE__, __LINE__, __VA_ARGS__)
#define vtkLogf(verbosity_name, ...) vtkVLogf(vtkLogger::VERBOSITY_##verbosity_name, __VA_ARGS__)
: vtkLogger::LogF(level, __FILE__, __LINE__, __VA_ARGS__)
#define vtkLogF(verbosity_name, ...) vtkVLogF(vtkLogger::VERBOSITY_##verbosity_name, __VA_ARGS__)
#define vtkVLog(level, x) \
if ((level) <= vtkLogger::GetCurrentVerbosityCutoff()) \
{ \
......@@ -447,21 +447,21 @@ private:
* Add to log only when the `cond` fails.
*
* // using printf-style
* vtkLogIff(ERROR, ptr != nullptr, "`ptr` cannot be null!");
* vtkVLogIff(vtkLogger::VERBOSITY_ERROR, ptr != nullptr, "`ptr` cannot be null!");
* vtkLogIfF(ERROR, ptr != nullptr, "`ptr` cannot be null!");
* vtkVLogIfF(vtkLogger::VERBOSITY_ERROR, ptr != nullptr, "`ptr` cannot be null!");
*
* // using streams
* vtkLogIf(ERROR, ptr != nullptr, "`ptr` cannot be null!");
* vtkVLogIf(vtkLogger::VERBOSITY_ERROR, ptr != nullptr, << "`ptr` cannot be null!");
*
*/
#define vtkVLogIff(level, cond, ...) \
#define vtkVLogIfF(level, cond, ...) \
((level) > vtkLogger::GetCurrentVerbosityCutoff() || (cond) == false) \
? (void)0 \
: vtkLogger::Logf(level, __FILE__, __LINE__, __VA_ARGS__)
: vtkLogger::LogF(level, __FILE__, __LINE__, __VA_ARGS__)
#define vtkLogIff(verbosity_name, cond, ...) \
vtkVLogIff(vtkLogger::VERBOSITY_##verbosity_name, cond, __VA_ARGS__)
#define vtkLogIfF(verbosity_name, cond, ...) \
vtkVLogIfF(vtkLogger::VERBOSITY_##verbosity_name, cond, __VA_ARGS__)
#define vtkVLogIf(level, cond, x) \
if ((level) <= vtkLogger::GetCurrentVerbosityCutoff() && (cond)) \
......@@ -480,15 +480,15 @@ private:
#define VTKLOG_CONCAT(s1, s2) VTKLOG_CONCAT_IMPL(s1, s2)
#define VTKLOG_ANONYMOUS_VARIABLE(x) VTKLOG_CONCAT(x, __LINE__)
#define vtkVLogScopef(level, ...) \
#define vtkVLogScopeF(level, ...) \
auto VTKLOG_ANONYMOUS_VARIABLE(msg_context) = ((level) > vtkLogger::GetCurrentVerbosityCutoff()) \
? vtkLogger::LogScopeRAII() \
: vtkLogger::LogScopeRAII(level, __FILE__, __LINE__, __VA_ARGS__)
#define vtkLogScopef(verbosity_name, ...) \
vtkVLogScopef(vtkLogger::VERBOSITY_##verbosity_name, __VA_ARGS__)
#define vtkLogScopeF(verbosity_name, ...) \
vtkVLogScopeF(vtkLogger::VERBOSITY_##verbosity_name, __VA_ARGS__)
#define vtkLogScopeFunction(verbosity_name) vtkLogScopef(verbosity_name, __func__)
#define vtkLogScopeFunction(verbosity_name) vtkLogScopeF(verbosity_name, __func__)
//@{
/**
......@@ -499,28 +499,33 @@ private:
vtkLogger::StartScope(vtkLogger::VERBOSITY_##verbosity_name, id, __FILE__, __LINE__)
#define vtkLogEndScope(id) vtkLogger::EndScope(id)
#define vtkLogStartScopef(verbosity_name, id, ...) \
vtkLogger::StartScopef(vtkLogger::VERBOSITY_##verbosity_name, id, __FILE__, __LINE__, __VA_ARGS__)
#define vtkLogStartScopeF(verbosity_name, id, ...) \
vtkLogger::StartScopeF(vtkLogger::VERBOSITY_##verbosity_name, id, __FILE__, __LINE__, __VA_ARGS__)
#define vtkVLogStartScope(level, id) vtkLogger::StartScope(level, id, __FILE__, __LINE__)
#define vtkVLogStartScopef(level, id, ...) \
vtkLogger::StartScopef(level, id, __FILE__, __LINE__, __VA_ARGS__)
#define vtkVLogStartScopeF(level, id, ...) \
vtkLogger::StartScopeF(level, id, __FILE__, __LINE__, __VA_ARGS__)
//@}
#else // if VTK_ENABLE_LOGGING
// define empty macros for non-logging enabled VTK builds.
#define vtkVLogf(level, ...)
#define vtkLogf(verbosity_name, ...)
#define vtkVLogF(level, ...)
#define vtkLogF(verbosity_name, ...)
#define vtkVLog(level, x)
#define vtkLog(verbosity_name, x)
#define vtkVLogIff(level, cond, ...)
#define vtkLogIff(verbosity_name, cond, ...)
#define vtkVLogIfF(level, cond, ...)
#define vtkLogIfF(verbosity_name, cond, ...)
#define vtkVLogIf(level, cond, x)
#define vtkLogIf(verbosity_name, cond, x)
#define vtkVLogScopef(level, ...)
#define vtkLogScopef(verbosity_name, ...)
#define vtkVLogScopeF(level, ...)
#define vtkLogScopeF(verbosity_name, ...)
#define vtkLogScopeFunction(verbosity_name)
#define vtkLogStartScope(verbosity_name, id)
#define vtkLogEndScope(id)
#define vtkLogStartScopeF(verbosity_name, id, ...)
#define vtkVLogStartScope(level, id)
#define vtkVLogStartScopeF(level, id, ...)
#endif // if VTK_ENABLE_LOGGING
......
......@@ -73,7 +73,7 @@ void vtkOutputWindowDisplayText(const char* message)
void vtkOutputWindowDisplayErrorText(const char* message)
{
vtkLogf(ERROR, "%s", message);
vtkLogF(ERROR, "%s", message);
if (auto win = vtkOutputWindow::GetInstance())
{
vtkOutputWindowPrivateAccessor helper_raii(win);
......@@ -83,7 +83,7 @@ void vtkOutputWindowDisplayErrorText(const char* message)
void vtkOutputWindowDisplayWarningText(const char* message)
{
vtkLogf(WARNING, "%s", message);
vtkLogF(WARNING, "%s", message);
if (auto win = vtkOutputWindow::GetInstance())
{
vtkOutputWindowPrivateAccessor helper_raii(win);
......@@ -93,7 +93,7 @@ void vtkOutputWindowDisplayWarningText(const char* message)
void vtkOutputWindowDisplayGenericWarningText(const char* message)
{
vtkLogf(WARNING, "%s", message);
vtkLogF(WARNING, "%s", message);
if (auto win = vtkOutputWindow::GetInstance())
{
vtkOutputWindowPrivateAccessor helper_raii(win);
......@@ -103,7 +103,7 @@ void vtkOutputWindowDisplayGenericWarningText(const char* message)
void vtkOutputWindowDisplayDebugText(const char* message)
{
vtkLogf(INFO, "%s", message);
vtkLogF(INFO, "%s", message);
if (auto win = vtkOutputWindow::GetInstance())
{
vtkOutputWindowPrivateAccessor helper_raii(win);
......
......@@ -185,7 +185,7 @@ int vtkDemandDrivenPipeline::ProcessRequest(vtkInformation* request,
if(this->PipelineMTime > this->DataObjectTime.GetMTime())
{
// Request data type from the algorithm.
vtkLogf(TRACE, "%s execute-data-object", vtkLogIdentifier(this->Algorithm));
vtkLogF(TRACE, "%s execute-data-object", vtkLogIdentifier(this->Algorithm));
result = this->ExecuteDataObject(request,inInfoVec,outInfoVec);
// Make sure the data object exists for all output ports.
......@@ -235,7 +235,7 @@ int vtkDemandDrivenPipeline::ProcessRequest(vtkInformation* request,
}
// Request information from the algorithm.
vtkLogf(TRACE, "%s execute-information", vtkLogIdentifier(this->Algorithm));
vtkLogF(TRACE, "%s execute-information", vtkLogIdentifier(this->Algorithm));
result = this->ExecuteInformation(request,inInfoVec,outInfoVec);
// Information is now up to date.
......@@ -273,7 +273,7 @@ int vtkDemandDrivenPipeline::ProcessRequest(vtkInformation* request,
}
// Request data from the algorithm.
vtkLogf(TRACE, "%s execute-data", vtkLogIdentifier(this->Algorithm));
vtkLogF(TRACE, "%s execute-data", vtkLogIdentifier(this->Algorithm));
result = this->ExecuteData(request,inInfoVec,outInfoVec);
// Data are now up to date.
......
......@@ -164,7 +164,7 @@ int vtkStreamingDemandDrivenPipeline
}
if(N2E)
{
vtkLogf(TRACE, "%s execute-update-time", vtkLogIdentifier(this->Algorithm));
vtkLogF(TRACE, "%s execute-update-time", vtkLogIdentifier(this->Algorithm));
result = this->CallAlgorithm(request, vtkExecutive::RequestUpstream,
inInfoVec, outInfoVec);
// Propagate the update extent to all inputs.
......@@ -207,7 +207,7 @@ int vtkStreamingDemandDrivenPipeline
{
return 0;
}
vtkLogf(TRACE, "%s execute-time-dependent-information", vtkLogIdentifier(this->Algorithm));
vtkLogF(TRACE, "%s execute-time-dependent-information", vtkLogIdentifier(this->Algorithm));
result = this->CallAlgorithm(request, vtkExecutive::RequestUpstream,
inInfoVec, outInfoVec);
}
......@@ -328,7 +328,7 @@ int vtkStreamingDemandDrivenPipeline
{
// Invoke the request on the algorithm.
this->LastPropogateUpdateExtentShortCircuited = 0;
vtkLogf(TRACE, "%s execute-update-extent", vtkLogIdentifier(this->Algorithm));
vtkLogF(TRACE, "%s execute-update-extent", vtkLogIdentifier(this->Algorithm));
result = this->CallAlgorithm(request, vtkExecutive::RequestUpstream,
inInfoVec, outInfoVec);
......
......@@ -26,7 +26,7 @@
#endif
#define VTK_FILE_LOCATOR_DEBUG_MESSAGE(...) \
vtkVLogf(static_cast<vtkLogger::Verbosity>(this->LogVerbosity), __VA_ARGS__)
vtkVLogF(static_cast<vtkLogger::Verbosity>(this->LogVerbosity), __VA_ARGS__)
#if defined(_WIN32) && !defined(__CYGWIN__)
// Implementation for Windows win32 code but not cygwin
......@@ -57,7 +57,7 @@ std::string vtkResourceFileLocator::Locate(const std::string& anchor,
const std::vector<std::string>& landmark_prefixes, const std::string& landmark,
const std::string& defaultDir)
{
vtkVLogScopef(
vtkVLogScopeF(
static_cast<vtkLogger::Verbosity>(this->LogVerbosity), "looking for '%s'", landmark.c_str());
std::vector<std::string> path_components;
vtksys::SystemTools::SplitPath(anchor, path_components);
......
......@@ -84,7 +84,7 @@ void display()
vtkLogScopeFunction(INFO);
if (!initialized)
{
vtkLogScopef(INFO, "do-initialize");
vtkLogScopeF(INFO, "do-initialize");
// since `handleResize` may get called before display, we may have already
// created and resized the vtkExternalOpenGLRenderWindow, hence we don't
// recreate it here.
......@@ -141,7 +141,7 @@ void display()
GLfloat ambient[] = {1.0f, 1.0f, 0.2f, 1.0f};
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
vtkLogScopef(INFO, "do-vtk-render");
vtkLogScopeF(INFO, "do-vtk-render");
externalVTKWidget->GetRenderWindow()->Render();
glutSwapBuffers();
}
......@@ -175,7 +175,7 @@ void test()
void handleResize(int w, int h)
{
vtkLogScopef(INFO, "handleResize: %d, %d", w, h);
vtkLogScopeF(INFO, "handleResize: %d, %d", w, h);
externalVTKWidget->GetRenderWindow()->SetSize(w, h);
glutPostRedisplay();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment