summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-10-02 18:46:10 -0300
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-10-03 11:25:32 -0300
commitf3f5e2a420d98eedc27fe7070a65d5cac6e58205 (patch)
tree133929df2f9de78ba4d7e3f1ab13393acc33d581
parentbed426c7632bf1e2df82ebf8e7a3e24f9ba7282e (diff)
downloadweekeyboard-f3f5e2a420d98eedc27fe7070a65d5cac6e58205.tar.gz
weekeyboard-f3f5e2a420d98eedc27fe7070a65d5cac6e58205.tar.bz2
weekeyboard-f3f5e2a420d98eedc27fe7070a65d5cac6e58205.zip
Make use of Eina_Log for debugging messages
Change-Id: I02d57342363ee5b9f7eed087453ba96d375acb14 Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
-rw-r--r--src/Makefile.am6
-rw-r--r--src/wkb-ibus-config-eet-test.c23
-rw-r--r--src/wkb-ibus-config-eet.c46
-rw-r--r--src/wkb-ibus-config-eet.h3
-rw-r--r--src/wkb-ibus-config-key.c9
-rw-r--r--src/wkb-ibus-config-key.h8
-rw-r--r--src/wkb-ibus-config.c1
-rw-r--r--src/wkb-ibus-panel.c1
-rw-r--r--src/wkb-ibus-test.c36
-rw-r--r--src/wkb-ibus.c29
-rw-r--r--src/wkb-ibus.h7
-rw-r--r--src/wkb-log.c55
-rw-r--r--src/wkb-log.h40
-rw-r--r--src/wkb-main.c43
14 files changed, 213 insertions, 94 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 389e6d9..7fa860a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,8 @@ AM_LDFLAGS= \
weekeyboard_SOURCES= \
wkb-main.c \
+ wkb-log.c \
+ wkb-log.h \
input-method-protocol.c \
input-method-client-protocol.h \
text-protocol.c \
@@ -25,6 +27,8 @@ noinst_PROGRAMS = \
weekeyboard-config-eet-test
weekeyboard_config_eet_test_SOURCES = \
+ wkb-log.c \
+ wkb-log.h \
wkb-ibus-config-key.c \
wkb-ibus-config-key.h \
wkb-ibus-config-eet.c \
@@ -37,6 +41,8 @@ noinst_PROGRAMS += \
weekeyboard_ibus_test_SOURCES = \
wkb-ibus.h \
wkb-ibus.c \
+ wkb-log.c \
+ wkb-log.h \
wkb-ibus-defs.h \
wkb-ibus-panel.c \
wkb-ibus-config.c \
diff --git a/src/wkb-ibus-config-eet-test.c b/src/wkb-ibus-config-eet-test.c
index 5266be9..1c993e5 100644
--- a/src/wkb-ibus-config-eet-test.c
+++ b/src/wkb-ibus-config-eet-test.c
@@ -15,36 +15,33 @@
*/
#include <stdio.h>
-#include <Eina.h>
#include <Eet.h>
#include "wkb-ibus-config-eet.h"
+#include "wkb-log.h"
int
main (int argc, char *argv[])
{
+ int ret = 1;
struct wkb_ibus_config_eet *cfg;
- if (!eina_init())
- {
- printf("Error initializing eina");
- return 1;
- }
+ if (!wkb_log_init("eet-test"))
+ return 1;
- if (!eet_init())
+ if (!wkb_ibus_config_eet_init())
{
- printf("Error initializing eet");
+ ERR("Error initializing eet");
goto eet_err;
}
cfg = wkb_ibus_config_eet_new("ibus-cfg.eet", NULL);
wkb_ibus_config_eet_free(cfg);
-
-end:
- eet_shutdown();
+ ret = 0;
+ wkb_ibus_config_eet_shutdown();
eet_err:
- eina_shutdown();
+ wkb_log_shutdown();
- return 0;
+ return ret;
}
diff --git a/src/wkb-ibus-config-eet.c b/src/wkb-ibus-config-eet.c
index 15b8fa2..380acac 100644
--- a/src/wkb-ibus-config-eet.c
+++ b/src/wkb-ibus-config-eet.c
@@ -27,6 +27,7 @@
#include "wkb-ibus-config-eet.h"
#include "wkb-ibus-config-key.h"
+#include "wkb-log.h"
/*
* Base struct for all config types
@@ -87,7 +88,7 @@ _config_section_find(struct _config_section *base, const char *section)
if (base->id && !strncasecmp(section, base->id, strlen(section)))
{
- printf("Requested section: '%s' match: '%s' \n", section, base->id);
+ DBG("Requested section: '%s' match: '%s'", section, base->id);
return base;
}
@@ -108,7 +109,7 @@ _config_section_find_key(struct _config_section *base, const char *section, cons
if (!(sec = _config_section_find(base, section)))
{
- printf("Config section with id '%s' not found\n", section);
+ DBG("Config section with id '%s' not found", section);
goto end;
}
@@ -117,7 +118,7 @@ _config_section_find_key(struct _config_section *base, const char *section, cons
key_id = wkb_config_key_id(key);
if (!strcasecmp(name, key_id))
{
- printf("Requested key: '%s' match: '%s'\n", name, key_id);
+ DBG("Requested key: '%s' match: '%s'", name, key_id);
ret = key;
break;
}
@@ -797,7 +798,7 @@ wkb_ibus_config_eet_set_value(struct wkb_ibus_config_eet *config_eet, const char
if (!(key = _config_section_find_key(config_eet->ibus_config, section, name)))
{
- printf("Config key with id '%s' not found\n", name);
+ ERR("Config key with id '%s' not found", name);
goto end;
}
@@ -807,7 +808,7 @@ wkb_ibus_config_eet_set_value(struct wkb_ibus_config_eet *config_eet, const char
if (!ef || !eet_data_write(ef, config_eet->ibus_edd, "ibus", config_eet->ibus_config, EINA_TRUE))
{
// FIXME
- printf("Error writing Eet file '%s'\n", config_eet->path);
+ ERR("Error writing Eet file '%s'", config_eet->path);
ret = EINA_FALSE;
}
eet_close(ef);
@@ -826,7 +827,7 @@ wkb_ibus_config_eet_get_value(struct wkb_ibus_config_eet *config_eet, const char
if (!(key = _config_section_find_key(config_eet->ibus_config, section, name)))
{
- printf("Config key with id '%s' not found\n", name);
+ ERR("Config key with id '%s' not found", name);
goto end;
}
@@ -847,7 +848,7 @@ wkb_ibus_config_eet_get_values(struct wkb_ibus_config_eet *config_eet, const cha
if (!(sec = _config_section_find(config_eet->ibus_config, section)))
{
- printf("Config section with id '%s' not found\n", section);
+ ERR("Config section with id '%s' not found", section);
goto end;
}
@@ -915,7 +916,7 @@ wkb_ibus_config_eet_new(const char *path, Eldbus_Service_Interface *iface)
if (!(ef = eet_open(path, mode)))
{
- printf("Error opening eet file '%s' for %s\n", path, mode == EET_FILE_MODE_READ ? "read" : "write");
+ ERR("Error opening eet file '%s' for %s", path, mode == EET_FILE_MODE_READ ? "read" : "write");
wkb_ibus_config_eet_free(eet);
return NULL;
}
@@ -930,7 +931,7 @@ wkb_ibus_config_eet_new(const char *path, Eldbus_Service_Interface *iface)
wkb_ibus_config_eet_set_defaults(eet);
if (!eet_data_write(ef, eet->ibus_edd, "ibus", eet->ibus_config, EINA_TRUE))
{
- printf("Error creating eet file '%s'\n", path);
+ ERR("Error creating eet file '%s'", path);
wkb_ibus_config_eet_free(eet);
eet = NULL;
}
@@ -955,3 +956,30 @@ wkb_ibus_config_eet_free(struct wkb_ibus_config_eet *config_eet)
free(config_eet);
}
+
+static int _init_count = 0;
+
+int
+wkb_ibus_config_eet_init(void)
+{
+ if (_init_count)
+ goto end;
+
+ if (!eet_init())
+ {
+ ERR("Error initializing Eet");
+ return 0;
+ }
+
+end:
+ return ++_init_count;
+}
+
+void
+wkb_ibus_config_eet_shutdown()
+{
+ if (_init_count <= 0 || --_init_count > 0)
+ return;
+
+ eet_shutdown();
+}
diff --git a/src/wkb-ibus-config-eet.h b/src/wkb-ibus-config-eet.h
index 020d8a4..40c5b89 100644
--- a/src/wkb-ibus-config-eet.h
+++ b/src/wkb-ibus-config-eet.h
@@ -31,4 +31,7 @@ void wkb_ibus_config_eet_set_defaults(struct wkb_ibus_config_eet *config_eet);
struct wkb_ibus_config_eet *wkb_ibus_config_eet_new(const char *path, Eldbus_Service_Interface *iface);
void wkb_ibus_config_eet_free(struct wkb_ibus_config_eet *config_eet);
+int wkb_ibus_config_eet_init(void);
+void wkb_ibus_config_eet_shutdown(void);
+
#endif /* _WKB_IBUS_CONFIG_EET_H_ */
diff --git a/src/wkb-ibus-config-key.c b/src/wkb-ibus-config-key.c
index b349b74..606a4ce 100644
--- a/src/wkb-ibus-config-key.c
+++ b/src/wkb-ibus-config-key.c
@@ -20,9 +20,8 @@
#include <unistd.h>
#include <string.h>
-#include <Eina.h>
-
#include "wkb-ibus-config-key.h"
+#include "wkb-log.h"
typedef void (*key_free_cb) (void *);
typedef Eina_Bool (*key_set_cb) (struct wkb_config_key *, Eldbus_Message_Iter *);
@@ -58,7 +57,7 @@ _key_new(const char *id, const char *signature, void *field, key_free_cb free_cb
_type *__field = (_type *) _key->field; \
if (!eldbus_message_iter_arguments_get(iter, _key->signature, &__value)) \
{ \
- printf("Error decoding " #_type " value using '%s'\n", _key->signature); \
+ ERR("Error decoding " #_type " value using '%s'", _key->signature); \
return EINA_FALSE; \
} \
*__field = __value; \
@@ -114,7 +113,7 @@ _key_string_set(struct wkb_config_key *key, Eldbus_Message_Iter *iter)
if (iter && !eldbus_message_iter_arguments_get(iter, "s", &str))
{
- printf("Error decoding string value using 's'\n");
+ ERR("Error decoding string value using 's'");
return EINA_FALSE;
}
@@ -255,7 +254,7 @@ wkb_config_key_get(struct wkb_config_key *key, Eldbus_Message_Iter *reply)
if (!(ret = key->get(key, value)))
{
- printf("Unexpected error retrieving value for key: '%s'\n", key->id);
+ ERR("Unexpected error retrieving value for key: '%s'", key->id);
}
eldbus_message_iter_container_close(reply, value);
diff --git a/src/wkb-ibus-config-key.h b/src/wkb-ibus-config-key.h
index 66514f6..1343fb5 100644
--- a/src/wkb-ibus-config-key.h
+++ b/src/wkb-ibus-config-key.h
@@ -20,6 +20,10 @@
#include <Eina.h>
#include <Eldbus.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct wkb_config_key;
struct wkb_config_key *wkb_config_key_int(const char *id, void *field);
@@ -33,4 +37,8 @@ const char *wkb_config_key_signature(struct wkb_config_key *key);
Eina_Bool wkb_config_key_set(struct wkb_config_key * key, Eldbus_Message_Iter *iter);
Eina_Bool wkb_config_key_get(struct wkb_config_key *key, Eldbus_Message_Iter *reply);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _WKB_IBUS_CONFIG_KEY_H_ */
diff --git a/src/wkb-ibus-config.c b/src/wkb-ibus-config.c
index c84f62b..96cdf56 100644
--- a/src/wkb-ibus-config.c
+++ b/src/wkb-ibus-config.c
@@ -24,6 +24,7 @@
#include "wkb-ibus.h"
#include "wkb-ibus-defs.h"
#include "wkb-ibus-config-eet.h"
+#include "wkb-log.h"
static struct wkb_ibus_config_eet *_conf_eet = NULL;
diff --git a/src/wkb-ibus-panel.c b/src/wkb-ibus-panel.c
index dfa77e9..abe5823 100644
--- a/src/wkb-ibus-panel.c
+++ b/src/wkb-ibus-panel.c
@@ -23,6 +23,7 @@
#include "wkb-ibus.h"
#include "wkb-ibus-defs.h"
+#include "wkb-log.h"
#define _panel_check_message_errors(_msg) \
do \
diff --git a/src/wkb-ibus-test.c b/src/wkb-ibus-test.c
index 3c281c7..76661c7 100644
--- a/src/wkb-ibus-test.c
+++ b/src/wkb-ibus-test.c
@@ -15,6 +15,7 @@
*/
#include "wkb-ibus.h"
+#include "wkb-log.h"
#define _GNU_SOURCE
#include <signal.h>
@@ -28,7 +29,7 @@
static void
_finish(int foo)
{
- printf("FINISH\n");
+ ERR("FINISH\n");
wkb_ibus_shutdown();
}
@@ -41,38 +42,26 @@ _connect_timer(void *data)
int
main (int argc, char *argv[])
{
- int ret = 0;
- if (!eet_init())
- {
- printf("Error initializing eet");
- return 1;
- }
+ int ret = 1;
+
+ if (!wkb_log_init("ibus-test"))
+ return 1;
if (!ecore_init())
{
- printf("Error initializing ecore");
- ret = 1;
+ ERR("Error initializing ecore");
goto ecore_err;
}
- if (!eldbus_init())
- {
- printf("Error initializing eldbus");
- ret = 1;
- goto eldbus_err;
- }
-
if (!efreet_init())
{
- printf("Error initializing efreet");
- ret = 1;
+ ERR("Error initializing efreet");
goto efreet_err;
}
if (!wkb_ibus_init())
{
- printf("Error initializing ibus");
- ret = 1;
+ ERR("Error initializing ibus");
goto end;
}
@@ -82,18 +71,19 @@ main (int argc, char *argv[])
signal(SIGINT, _finish);
ecore_main_loop_begin();
+ ret = 0;
end:
efreet_shutdown();
efreet_err:
- eldbus_shutdown();
-
-eldbus_err:
ecore_shutdown();
ecore_err:
eet_shutdown();
+eet_err:
+ wkb_log_shutdown();
+
return ret;
}
diff --git a/src/wkb-ibus.c b/src/wkb-ibus.c
index b2ac6f1..a32c835 100644
--- a/src/wkb-ibus.c
+++ b/src/wkb-ibus.c
@@ -24,8 +24,7 @@
#include "wkb-ibus.h"
#include "wkb-ibus-defs.h"
-
-int _wkb_ibus_log_dom = -1;
+#include "wkb-log.h"
#define _check_message_errors(_msg) \
do \
@@ -322,31 +321,29 @@ wkb_ibus_connect(void)
return EINA_TRUE;
}
-
int
wkb_ibus_init(void)
{
- if (ctx && ctx->refcount > 0)
+ if (ctx && ctx->refcount)
goto end;
- if (!eina_init())
+ if (!eldbus_init())
{
- fprintf(stderr, "Error initializing Eina\n");
+ ERR("Error initializing Eldbus");
return 0;
}
- _wkb_ibus_log_dom = eina_log_domain_register("wkb-ibus", EINA_COLOR_LIGHTCYAN);
- if (_wkb_ibus_log_dom < 0)
- {
- EINA_LOG_ERR("Unable to register 'wkb-ibus' log domain");
- eina_shutdown();
- return 0;
- }
+ if (!wkb_ibus_config_eet_init())
+ {
+ ERR("Error initializing wkb_config_eetn");
+ eldbus_shutdown();
+ return -0;
+ }
if (!ctx && !(ctx = calloc(1, sizeof(*ctx))))
{
- ERR("Error calloc\n");
- eina_shutdown();
+ ERR("Error calloc");
+ eldbus_shutdown();
return 0;
}
@@ -361,7 +358,7 @@ wkb_ibus_shutdown(void)
{
if (!ctx)
{
- fprintf(stderr, "Not initialized\n");
+ ERR("Not initialized");
return;
}
diff --git a/src/wkb-ibus.h b/src/wkb-ibus.h
index d423859..8d04acf 100644
--- a/src/wkb-ibus.h
+++ b/src/wkb-ibus.h
@@ -24,13 +24,6 @@
extern "C" {
#endif
-extern int _wkb_ibus_log_dom;
-#define DBG(...) EINA_LOG_DOM_DBG(_wkb_ibus_log_dom, __VA_ARGS__)
-#define INF(...) EINA_LOG_DOM_INFO(_wkb_ibus_log_dom, __VA_ARGS__)
-#define WRN(...) EINA_LOG_DOM_WARN(_wkb_ibus_log_dom, __VA_ARGS__)
-#define ERR(...) EINA_LOG_DOM_ERR(_wkb_ibus_log_dom, __VA_ARGS__)
-#define CRITICAL(...) EINA_LOG_DOM_CRIT(_wkb_ibus_log_dom, __VA_ARGS__)
-
int wkb_ibus_init(void);
void wkb_ibus_shutdown(void);
diff --git a/src/wkb-log.c b/src/wkb-log.c
new file mode 100644
index 0000000..543bb53
--- /dev/null
+++ b/src/wkb-log.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wkb-log.h"
+
+int _wkb_log_domain = -1;
+static int _init_count = 0;
+
+int
+wkb_log_init(const char *domain)
+{
+ if (_init_count)
+ goto end;
+
+ if (!eina_init())
+ {
+ fprintf(stderr, "%s:%d - %s() Error initializing Eina\n", __FILE__, __LINE__, __FUNCTION__);
+ return 0;
+ }
+
+ _wkb_log_domain = eina_log_domain_register(domain, EINA_COLOR_LIGHTCYAN);
+
+ if (_wkb_log_domain < 0)
+ {
+ EINA_LOG_ERR("Unable to register '%s' log domain", domain);
+ eina_shutdown();
+ return 0;
+ }
+
+end:
+ return ++_init_count;
+}
+
+void
+wkb_log_shutdown(void)
+{
+ if (_init_count <= 0 || --_init_count > 0)
+ return;
+
+ eina_log_domain_unregister(_wkb_log_domain);
+ eina_shutdown();
+}
diff --git a/src/wkb-log.h b/src/wkb-log.h
new file mode 100644
index 0000000..fd43e62
--- /dev/null
+++ b/src/wkb-log.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _WKB_LOG_H_
+#define _WKB_LOG_H_
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int _wkb_log_domain;
+#define DBG(...) EINA_LOG_DOM_DBG(_wkb_log_domain, __VA_ARGS__)
+#define INF(...) EINA_LOG_DOM_INFO(_wkb_log_domain, __VA_ARGS__)
+#define WRN(...) EINA_LOG_DOM_WARN(_wkb_log_domain, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_wkb_log_domain, __VA_ARGS__)
+#define CRITICAL(...) EINA_LOG_DOM_CRIT(_wkb_log_domain, __VA_ARGS__)
+
+int wkb_log_init(const char *domain);
+void wkb_log_shutdown(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WKB_LOG_H_ */
diff --git a/src/wkb-main.c b/src/wkb-main.c
index 9509cd4..dd10b29 100644
--- a/src/wkb-main.c
+++ b/src/wkb-main.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
+#include "wkb-log.h"
#include "input-method-client-protocol.h"
#include "text-client-protocol.h"
@@ -171,7 +172,7 @@ _cb_wkb_on_key_down(void *data, Evas_Object *obj, const char *emission EINA_UNUS
if (_wkb_ignore_key(wkb, key))
{
- printf("Ignoring key '%s'\n", key);
+ DBG("Ignoring key: '%s'", key);
goto end;
}
else if (strcmp(key, "backspace") == 0)
@@ -202,7 +203,7 @@ _cb_wkb_on_key_down(void *data, Evas_Object *obj, const char *emission EINA_UNUS
key = " ";
}
- printf("KEY = '%s'\n", key);
+ DBG("Key pressed: '%s'", key);
_wkb_update_preedit_str(wkb, key);
@@ -215,7 +216,7 @@ _wkb_im_ctx_surrounding_text(void *data, struct wl_input_method_context *im_ctx,
{
struct weekeyboard *wkb = data;
- printf("%s()\n", __FUNCTION__);
+ DBG("");
free(wkb->surrounding_text);
wkb->surrounding_text = strdup(text);
wkb->surrounding_cursor = cursor;
@@ -226,7 +227,7 @@ _wkb_im_ctx_reset(void *data, struct wl_input_method_context *im_ctx)
{
struct weekeyboard *wkb = data;
- printf("%s()\n", __FUNCTION__);
+ DBG("");
if (strlen(wkb->preedit_str))
{
@@ -240,7 +241,7 @@ _wkb_im_ctx_content_type(void *data, struct wl_input_method_context *im_ctx, uin
{
struct weekeyboard *wkb = data;
- printf("%s(): im_context = %p hint = %d purpose = %d\n", __FUNCTION__, im_ctx, hint, purpose);
+ DBG("im_context = %p hint = %d purpose = %d", im_ctx, hint, purpose);
if (!wkb->context_changed)
return;
@@ -271,7 +272,7 @@ _wkb_im_ctx_invoke_action(void *data, struct wl_input_method_context *im_ctx, ui
{
struct weekeyboard *wkb = data;
- printf("%s()\n", __FUNCTION__);
+ DBG("");
if (button != BTN_LEFT)
return;
@@ -283,9 +284,9 @@ _wkb_im_ctx_commit_state(void *data, struct wl_input_method_context *im_ctx, uin
{
struct weekeyboard *wkb = data;
- printf("%s()\n", __FUNCTION__);
+ DBG("");
if (wkb->surrounding_text)
- fprintf(stderr, "Surrounding text updated: %s\n", wkb->surrounding_text);
+ INF("Surrounding text updated: %s", wkb->surrounding_text);
wkb->serial = serial;
/* FIXME */
@@ -310,7 +311,7 @@ _wkb_im_ctx_preferred_language(void *data, struct wl_input_method_context *im_ct
if (language)
{
wkb->language = strdup(language);
- printf("Language changed, new: '%s\n", language);
+ INF("Language changed, new: '%s'", language);
}
}
@@ -411,12 +412,12 @@ _wkb_ui_setup(struct weekeyboard *wkb)
w = 600;
sprintf(path, PKGDATADIR"/default_%d.edj", w);
- printf("Loading edje file: '%s'\n", path);
+ DBG("Loading edje file: '%s'", path);
if (!edje_object_file_set(wkb->edje_obj, path, "main"))
{
int err = edje_object_load_error_get(wkb->edje_obj);
- fprintf(stderr, "error loading the edje file:%s\n", edje_load_error_str(err));
+ ERR("error loading the edje file: '%s'", edje_load_error_str(err));
return EINA_FALSE;
}
@@ -459,11 +460,11 @@ _wkb_ui_setup(struct weekeyboard *wkb)
ignore_keys = edje_file_data_get(path, "ignore-keys");
if (!ignore_keys)
{
- printf("Special keys file not found in '%s'\n", path);
+ ERR("Special keys file not found in: '%s'", path);
goto end;
}
- printf("Got ignore keys = %s\n", ignore_keys);
+ DBG("Got ignore keys: '%s'", ignore_keys);
wkb->ignore_keys = eina_str_split(ignore_keys, "\n", 0);
free(ignore_keys);
@@ -535,13 +536,13 @@ _wkb_check_evas_engine(struct weekeyboard *wkb)
env = "wayland_egl";
else
{
- printf("ERROR: Ecore_Evas does must be compiled with support for Wayland engines\n");
+ ERR("ERROR: Ecore_Evas does must be compiled with support for Wayland engines");
goto err;
}
}
else if (strcmp(env, "wayland_shm") != 0 && strcmp(env, "wayland_egl") != 0)
{
- printf("ERROR: ECORE_EVAS_ENGINE must be set to either 'wayland_shm' or 'wayland_egl'\n");
+ ERR("ERROR: ECORE_EVAS_ENGINE must be set to either 'wayland_shm' or 'wayland_egl'");
goto err;
}
@@ -558,11 +559,11 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
struct weekeyboard wkb = {0};
int ret = EXIT_FAILURE;
- if (!ecore_init())
+ if (!wkb_log_init("weekeyboard"))
return ret;
if (!ecore_evas_init())
- goto ecore_err;
+ goto log_err;
if (!edje_init())
goto ee_err;
@@ -570,12 +571,12 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
if (!_wkb_check_evas_engine(&wkb))
goto edj_err;
- printf("SELECTED ENGINE = %s\n", wkb.ee_engine);
+ DBG("Selected engine: '%s'", wkb.ee_engine);
wkb.ee = ecore_evas_new(wkb.ee_engine, 0, 0, 1, 1, "frame=0");
if (!wkb.ee)
{
- printf("ERROR: Unable to create Ecore_Evas object\n");
+ ERR("ERROR: Unable to create Ecore_Evas object");
goto edj_err;
}
@@ -599,8 +600,8 @@ edj_err:
ee_err:
ecore_evas_shutdown();
-ecore_err:
- ecore_shutdown();
+log_err:
+ wkb_log_shutdown();
return ret;
}