[Mesa-dev] [PATCH v2 2/3] egl: introduce a log level getter function

Silvestrs Timofejevs silvestrs.timofejevs at imgtec.com
Thu Dec 20 10:02:34 UTC 2018


Being able to retrieve the log level can be useful to enable/disable
debug code. The alternative, which is calling 'getenv' function every
time to retrieve the log level, is more "expensive".

Signed-off-by: Silvestrs Timofejevs <silvestrs.timofejevs at imgtec.com>
---
 src/egl/main/egllog.c | 9 +++++++++
 src/egl/main/egllog.h | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index c223f49..42bae01 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -133,6 +133,15 @@ _eglInitLogger(void)
    }
 }
 
+/**
+ * Return the log level.
+ */
+EGLint
+_eglGetLogLevel(void)
+{
+   return logging.level;
+}
+
 
 /**
  * Log a message with message logger.
diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h
index 2a06a34..a1cf977 100644
--- a/src/egl/main/egllog.h
+++ b/src/egl/main/egllog.h
@@ -44,6 +44,10 @@ extern "C" {
 #define _EGL_DEBUG   3   /* useful info for debugging */
 
 
+extern EGLint
+_eglGetLogLevel(void);
+
+
 extern void
 _eglLog(EGLint level, const char *fmtStr, ...);
 
-- 
2.7.4



More information about the mesa-dev mailing list