aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2017-10-23 23:17:47 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-11-01 11:02:26 +0000
commit860d9537b74f6fe406d21d3da753a3d09b995557 (patch)
tree7c3156923f0b7499456764b4de8f6a68f685ddc0 /src/main.cpp
parentbe02238a0e92c74a13daaf516b5f379f29217eb8 (diff)
Add debug message macros controlled by environment variable
Add a HMI_DEBUG macro to print debug messages. It is controlled by the USE_HMI_DEBUG environment variable. Change-Id: I3bc5bf2f3b0e9f5ee06f340053f29ad36e7d9dbb Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/main.cpp')
-rwxr-xr-xsrc/main.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c90eeb1..a8bb563 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -52,7 +52,7 @@ int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events,
ST();
if ((events & EPOLLHUP) != 0) {
- logerror("The compositor hung up, dying now.");
+ HMI_ERROR("wm", "The compositor hung up, dying now.");
delete g_afb_instance;
g_afb_instance = nullptr;
goto error;
@@ -93,15 +93,15 @@ error:
// |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___|_|_| |_|_|\__| | | |
// |___/_____| \_\/_/
int binding_init_() {
- lognotice("WinMan ver. %s", WINMAN_VERSION_STRING);
+ HMI_NOTICE("wm", "WinMan ver. %s", WINMAN_VERSION_STRING);
if (g_afb_instance != nullptr) {
- logerror("Wayland context already initialized?");
+ HMI_ERROR("wm", "Wayland context already initialized?");
return 0;
}
if (getenv("XDG_RUNTIME_DIR") == nullptr) {
- logerror("Environment variable XDG_RUNTIME_DIR not set");
+ HMI_ERROR("wm", "Environment variable XDG_RUNTIME_DIR not set");
goto error;
}
@@ -112,10 +112,10 @@ int binding_init_() {
while (!g_afb_instance->display->ok()) {
cnt++;
if (20 <= cnt) {
- logerror("Could not connect to compositor");
+ HMI_ERROR("wm", "Could not connect to compositor");
goto error;
}
- logerror("Wait to start weston ...");
+ HMI_ERROR("wm", "Wait to start weston ...");
sleep(1);
delete g_afb_instance;
g_afb_instance = new afb_instance;
@@ -123,7 +123,7 @@ int binding_init_() {
}
if (g_afb_instance->init() == -1) {
- logerror("Could not connect to compositor");
+ HMI_ERROR("wm", "Could not connect to compositor");
goto error;
}
@@ -132,7 +132,7 @@ int binding_init_() {
g_afb_instance->display->get_fd(), EPOLLIN,
display_event_callback, g_afb_instance);
if (ret < 0) {
- logerror("Could not initialize afb_instance event handler: %d", -ret);
+ HMI_ERROR("wm", "Could not initialize afb_instance event handler: %d", -ret);
goto error;
}
}
@@ -151,7 +151,7 @@ int binding_init() noexcept {
try {
return binding_init_();
} catch (std::exception &e) {
- logerror("Uncaught exception in binding_init(): %s", e.what());
+ HMI_ERROR("wm", "Uncaught exception in binding_init(): %s", e.what());
}
return -1;
}
@@ -162,19 +162,19 @@ int binding_init() noexcept {
namespace wm {
void binding_api::send_event(char const *evname, char const *label) {
- logdebug("%s: %s(%s)", __func__, evname, label);
+ HMI_DEBUG("wm", "%s: %s(%s)", __func__, evname, label);
json_object *j = json_object_new_object();
json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
int ret = afb_event_push(g_afb_instance->app.map_afb_event[evname], j);
if (ret != 0) {
- logdebug("afb_event_push failed: %m");
+ HMI_DEBUG("wm", "afb_event_push failed: %m");
}
}
void binding_api::send_event(char const *evname, char const *label, char const *area) {
- logdebug("%s: %s(%s, %s)", __func__, evname, label, area);
+ HMI_DEBUG("wm", "%s: %s(%s, %s)", __func__, evname, label, area);
json_object *j = json_object_new_object();
json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
@@ -182,7 +182,7 @@ void binding_api::send_event(char const *evname, char const *label, char const *
int ret = afb_event_push(g_afb_instance->app.map_afb_event[evname], j);
if (ret != 0) {
- logdebug("afb_event_push failed: %m");
+ HMI_DEBUG("wm", "afb_event_push failed: %m");
}
}
} // namespace wm