eina_error: deprecated old logging, move to eina_log.
authorbarbieri <barbieri>
Fri, 4 Sep 2009 01:37:11 +0000 (01:37 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 4 Sep 2009 01:37:11 +0000 (01:37 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@42220 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/include/eina_error.h
src/lib/eina_error.c
src/lib/eina_magic.c
src/tests/eina_test_error.c

index ad69ac0..2644a35 100644 (file)
  */
 
 /**
+ * @deprecated use EINA_LOG_ERR() instead.
  * @def EINA_ERROR_PERR(fmt, ...)
  * Print the error message described with the formatted string @a fmt
  * using the current print callback, file function and line, with the
  * error level EINA_ERROR_LEVEL_ERR.
  */
 #define EINA_ERROR_PERR(fmt, ...) \
-       eina_error_print(EINA_ERROR_LEVEL_ERR, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+       eina_error_print(EINA_LOG_LEVEL_ERR, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
 
 /**
+ * @deprecated use EINA_LOG_INFO() instead.
  * @def EINA_ERROR_PINFO(fmt, ...)
  * Print the error message described with the formatted string @a fmt
  * using the current print callback, file function and line, with the
  * error level EINA_ERROR_LEVEL_INFO.
  */
 #define EINA_ERROR_PINFO(fmt, ...) \
-       eina_error_print(EINA_ERROR_LEVEL_INFO, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+       eina_error_print(EINA_LOG_LEVEL_INFO, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
 
 /**
+ * @deprecated use EINA_LOG_WARN() instead.
  * @def EINA_ERROR_PWARN(fmt, ...)
  * Print the error message described with the formatted string @a fmt
  * using the current print callback, file function and line, with the
  * error level EINA_ERROR_LEVEL_WARN.
  */
 #define EINA_ERROR_PWARN(fmt, ...) \
-       eina_error_print(EINA_ERROR_LEVEL_WARN, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+       eina_error_print(EINA_LOG_LEVEL_WARN, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
 
 /**
+ * @deprecated use EINA_LOG_DBG() instead.
  * @def EINA_ERROR_PDBG(fmt, ...)
  * Print the error message described with the formatted string @a fmt
  * using the current print callback, file function and line, with the
  * error level EINA_ERROR_LEVEL_DBG.
  */
 #define EINA_ERROR_PDBG(fmt, ...) \
-       eina_error_print(EINA_ERROR_LEVEL_DBG, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+       eina_error_print(EINA_LOG_LEVEL_DBG, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
 
-/**
- * @typedef Eina_Error_Level
- * List of available error levels.
- */
-
-/**
- * @enum _Eina_Error_Level
- * List of available error levels.
- */
-typedef enum _Eina_Error_Level
-{
-       EINA_ERROR_LEVEL_ERR,   /**< Error error level */
-       EINA_ERROR_LEVEL_WARN,  /**< Warning error level */
-       EINA_ERROR_LEVEL_INFO,  /**< Information error level */
-       EINA_ERROR_LEVEL_DBG,   /**< Debug error level */
-       EINA_ERROR_LEVELS       /**< Count of error level */
-} Eina_Error_Level;
 
 /**
  * @typedef Eina_Error
@@ -96,14 +83,6 @@ typedef enum _Eina_Error_Level
 typedef int Eina_Error;
 
 /**
- * @typedef Eina_Error_Print_Cb
- * Type for print callbacks.
- */
-typedef void (*Eina_Error_Print_Cb)(Eina_Error_Level level, const char *file,
-                const char *fnc, int line, const char *fmt, void *data,
-               va_list args);
-
-/**
  * @var EINA_ERROR_OUT_OF_MEMORY
  * Error identifier corresponding to a lack of memory.
  */
@@ -115,19 +94,11 @@ EAPI Eina_Error eina_error_msg_register(const char *msg) EINA_ARG_NONNULL(1);
 EAPI Eina_Error eina_error_get(void);
 EAPI void eina_error_set(Eina_Error err);
 EAPI const char * eina_error_msg_get(Eina_Error error) EINA_PURE;
-EAPI void eina_error_print(Eina_Error_Level level, const char *file,
-               const char *function, int line, const char *fmt, ...) EINA_ARG_NONNULL(2, 3, 5) EINA_PRINTF(5, 6);
-EAPI void eina_error_vprint(Eina_Error_Level level, const char *file,
-               const char *fnc, int line, const char *fmt, va_list args) EINA_ARG_NONNULL(2, 3, 5);
-
-EAPI void eina_error_print_cb_stdout(Eina_Error_Level level, const char *file,
-                const char *fnc, int line, const char *fmt, void *data,
-               va_list args);
-EAPI void eina_error_print_cb_file(Eina_Error_Level level, const char *file,
-                const char *fnc, int line, const char *fmt, void *data,
-                va_list args);
-EAPI void eina_error_print_cb_set(Eina_Error_Print_Cb cb, void *data) EINA_ARG_NONNULL(1);
-EAPI void eina_error_log_level_set(Eina_Error_Level level);
+EAPI void eina_error_print(int level, const char *file,
+               const char *function, int line, const char *fmt, ...) EINA_ARG_NONNULL(2, 3, 5) EINA_PRINTF(5, 6) EINA_DEPRECATED;
+EAPI void eina_error_vprint(int level, const char *file,
+               const char *fnc, int line, const char *fmt, va_list args) EINA_ARG_NONNULL(2, 3, 5) EINA_DEPRECATED;
+EAPI void eina_error_log_level_set(int level) EINA_DEPRECATED;
 
 /**
  * @}
index c439353..1c6611f 100644 (file)
@@ -24,9 +24,8 @@
  *
  * The Eina error module provides a way to manage errors in a simple
  * but powerful way in libraries and modules. It is also used in Eina
- * itself. It provides facilities for displaying different kind of
- * messages (warning, informations, errors, or debug), which can be
- * tuned by the user, or for registering new errors messages.
+ * itself. Similar to libC's @c errno and strerror() facilities, this
+ * is extensible and recommended for other libraries and applications.
  *
  * @section tutorial_error_basic_usage Basic Usage
  *
  * gcc -Wall -o my_exe my_source.c `pkg-config --cflags --libs eina`
  * @endcode
  *
- * Now that the error module is initialized, error messages can
- * be displayed. Helper macros are already defined for such purpose:
- *
- * @li EINA_ERROR_PERR(),
- * @li EINA_ERROR_PINFO(),
- * @li EINA_ERROR_PWARN(),
- * @li EINA_ERROR_PDBG().
- *
- * Here is an example:
- *
- * @code
- * #include <stdlib.h>
- * #include <stdio.h>
- *
- * #include <eina_error.h>
- *
- * void test(int i)
- * {
- *    EINA_ERROR_PDBG("Entering test\n");
- *
- *    if (i < 0)
- *    {
- *        EINA_ERROR_PERR("argument is negative\n");
- *        return;
- *    }
- *
- *    EINA_ERROR_PINFO("argument non negative\n");
- *
- *    EINA_ERROR_PDBG("Exiting test\n");
- * }
- *
- * int main(void)
- * {
- *    if (!eina_error_init())
- *    {
- *        printf ("Error during the initialization of eina_error module\n");
- *        return EXIT_FAILURE;
- *    }
- *
- *    test(-1);
- *    test(0);
- *
- *    eina_error_shutdown();
- *
- *    return EXIT_SUCCESS;
- * }
- * @endcode
- *
- * If you compiled Eina without debug mode, after executing that
- * program, you will see only 1 message (the argument being
- * negative). Why ? These macros are just wrappers around
- * eina_error_print(). This function only displays messages if the
- * current error level is lesser or equal than the one used by
- * eina_error_print(). By default, the current error level is
- * #EINA_ERROR_LEVEL_ERR (in non debug mode), and the macro uses
- * the error values defines by #Eina_Error_Level. So as
- * #EINA_ERROR_LEVEL_ERR is the smallest value, only
- * EINA_ERROR_PERR() will display the message.
- *
- * To modify this behavior, you have two solutions:
- *
- * @li Using the environment variable EINA_ERROR_LEVEL. In that case,
- * just set the environment variable to a integer number between 0
- * (#EINA_ERROR_LEVEL_ERR) and 3 (#EINA_ERROR_LEVEL_DBG)
- * before executing the program. That environment variable will be
- * read during the first call of eina_error_init().
- * @li Using the function eina_error_log_level_set().
- *
- * So try using the environment variable like this:
- *
- * @code
- * EINA_ERROR_LEVEL=2 ./my_app
- * @endcode
- *
- * To do the same with eina_error_log_level_set(), just add
- *
- * @code
- * eina_error_log_level_set(EINA_ERROR_LEVEL_INFO);
- * @endcode
- *
- * before the calls of the tests in the above example.
- *
- * @section tutorial_error_advanced_display Advanced usage of print callbacks
- *
- * The error module allows the user to change the way
- * eina_error_print() displays the messages. It suffices to pass to
- * eina_error_print_cb_set() the function used to display the
- * message. That  function must be of type #Eina_Error_Print_Cb. As a
- * custom data can be passed to that callback, powerful display
- * messages can be displayed.
- *
- * It is suggested to not use __FILE__, __FUNCTION__ or __LINE__ when
- * writing that callback, but when defining macros (like
- * EINA_ERROR_PERR() and other macros).
- *
- * Here is an example of custom callback, whose behavior can be
- * changed at runtime:
- *
- * @code
- * #include <stdlib.h>
- * #include <stdio.h>
- *
- * #include <eina_error.h>
- *
- * #define ERROR(fmt, ...)                                    \
- *    eina_error_print(EINA_ERROR_LEVEL_ERR, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
- *
- * typedef struct _Data Data;
- *
- * struct _Data
- * {
- *    int to_stderr;
- * };
- *
- * void print_cb(Eina_Error_Level level,
- *               const char *file,
- *               const char *fnc,
- *               int line,
- *               const char *fmt,
- *               void *data,
- *               va_list args)
- * {
- *    Data *d;
- *    FILE *output;
- *    char *str;
- *
- *    d = (Data *)data;
- *    if (d->to_stderr)
- *    {
- *       output = stderr;
- *       str = "stderr";
- *    }
- *    else
- *    {
- *       output = stdout;
- *       str = "stdout";
- *    }
- *
- *    fprintf(output, "%s:%s (%d) %s: ", file, fnc, line, str);
- *    vfprintf(output, fmt, args);
- * }
- *
- * void test(Data *data, int i)
- * {
- *    if (i < 0)
- *       data->to_stderr = 0;
- *    else
- *       data->to_stderr = 1;
- *
- *    ERROR("error message...\n");
- * }
- *
- * int main(void)
- * {
- *    Data *data;
- *
- *    if (!eina_error_init())
- *    {
- *       printf ("Error during the initialization of eina_error module\n");
- *       return EXIT_FAILURE;
- *    }
- *
- *    data = (Data *)malloc(sizeof(Data));
- *    if (!data)
- *    {
- *       printf ("Error during memory allocation\n");
- *       eina_error_shutdown();
- *       return EXIT_FAILURE;
- *    }
- *
- *    eina_error_print_cb_set(print_cb, data);
- *
- *    test(data, -1);
- *    test(data, 0);
- *
- *    eina_error_shutdown();
- *
- *    return EXIT_SUCCESS;
- * }
- * @endcode
  *
  * @section tutorial_error_registering_msg Registering messages
  *
  * }
  * @endcode
  *
- * Of course, instead of printf(), eina_error_print() can be used to
+ * Of course, instead of printf(), eina_log_print() can be used to
  * have beautiful error messages.
  */
 
 #include "eina_safety_checks.h"
 #include "eina_error.h"
 #include "eina_inlist.h"
+#include "eina_log.h" /* remove me when eina_error_print is removed! */
 
 /* TODO
  * + printing errors to stdout or stderr can be implemented
@@ -385,27 +205,6 @@ static int _eina_error_init_count = 0;
 static Eina_Inlist *_error_list = NULL;
 static int _error_list_count = 0;
 static Eina_Error _err;
-static Eina_Error_Print_Cb _print_cb = eina_error_print_cb_stdout;
-static void *_print_cb_data = NULL;
-
-#define RED     "\033[31;1m"
-#define GREEN   "\033[32;1m"
-#define YELLOW  "\033[33;1m"
-#define WHITE   "\033[37;1m"
-#define NOTHING "\033[0m"
-
-#ifdef DEBUG
-static Eina_Error_Level _error_level = EINA_ERROR_LEVEL_DBG;
-#else
-static Eina_Error_Level _error_level = EINA_ERROR_LEVEL_ERR;
-#endif
-
-static const char *_colors[EINA_ERROR_LEVELS] = {
-  RED, // EINA_ERROR_LEVEL_ERR
-  YELLOW, // EINA_ERROR_LEVEL_WARN
-  NOTHING, // EINA_ERROR_LEVEL_INFO
-  GREEN, // EINA_ERROR_LEVEL_DBG
-};
 
 /**
  * @endcond
@@ -426,60 +225,12 @@ static const char *_colors[EINA_ERROR_LEVELS] = {
  * @brief These functions provide error management for projects.
  *
  * The error system must be initialized with eina_error_init() and
- * shut down with eina_error_shutdown(). The most generic way to print
- * errors is to use eina_error_print() but the helper macros
- * EINA_ERROR_PERR(), EINA_ERROR_PINFO(), EINA_ERROR_PWARN() and
- * EINA_ERROR_PDBG() should be used instead.
- *
- * Here is a straightforward example:
- *
- * @code
- * #include <stdlib.h>
- * #include <stdio.h>
+ * shut down with eina_error_shutdown(). Error codes are registered
+ * with eina_error_msg_register() and converted from identifier to
+ * original message string with eina_error_msg_get().
  *
- * #include <eina_error.h>
- *
- * void test_warn(void)
- * {
- *    EINA_ERROR_PWARN("Here is a warning message\n");
- * }
- *
- * int main(void)
- * {
- *    if (!eina_error_init())
- *    {
- *        printf ("Error during the initialization of eina_error module\n");
- *        return EXIT_FAILURE;
- *    }
- *
- *    test_warn();
- *
- *    eina_error_shutdown();
- *
- *    return EXIT_SUCCESS;
- * }
- * @endcode
- *
- * Compile this code with the following command:
- *
- * @code
- * gcc -Wall -o test_eina_error test_eina.c `pkg-config --cflags --libs eina`
- * @endcode
- *
- * If Eina is compiled without debug mode, then executing the
- * resulting program displays nothing because the default error level
- * is #EINA_ERROR_LEVEL_ERR and we want to display a warning
- * message, which level is strictly greater than the error level (see
- * eina_error_print() for more informations). Now execute the program
- * with:
- *
- * @code
- * EINA_ERROR_LEVEL=2 ./test_eina_error
- * @endcode
- *
- * You should see a message displayed in the terminal.
- *
- * For more information, you can look at the @ref tutorial_error_page.
+ * Logging functions are not in eina_error anymore, see
+ * eina_log_print() instead.
  *
  * @{
  */
@@ -525,16 +276,11 @@ EAPI Eina_Error EINA_ERROR_OUT_OF_MEMORY = 0;
  */
 EAPI int eina_error_init(void)
 {
-   const char *level;
-
    _eina_error_init_count++;
    if (_eina_error_init_count != 1)
      return _eina_error_init_count;
 
    /* TODO register the eina's basic errors */
-   if ((level = getenv("EINA_ERROR_LEVEL")))
-       _error_level = atoi(level);
-
    EINA_ERROR_OUT_OF_MEMORY = eina_error_msg_register("Out of memory");
 
    if (!eina_safety_checks_init())
@@ -658,150 +404,46 @@ EAPI void eina_error_set(Eina_Error err)
 }
 
 /**
- * @brief Print the error to a file.
- *
- * @param level The error level.
- * @param file The name of the file where the error occurred.
- * @param fnc The name of the function where the error occurred.
- * @param line The number of the line where the error occurred.
- * @param fmt The format to use.
- *
- * This function sends to a stream (like stdout or stderr) a formatted
- * string that describes the error. The error level is set by
- * @p level, the name of the file, of the function and the number of the
- * line where the error occurred are respectively set by @p file,
- * @p fnc and @p line. A description of the error message is given by
- * @p fmt, which is a formatted string, followed by optional arguments
- * that can be converted (like with printf). If @p level is strictly
- * larger than the current error level, that function returns
- * immediately, otherwise it prints all the errors up to the current
- * error level. The current error level can be changed with
- * eina_error_log_level_set(). See also eina_error_init() for more
- * informations.
- *
- * By default, that formatted message is send to stdout and is
- * formatted by eina_error_print_cb_stdout(). The destination of the
- * formatted message is send and the way it is formatted can be
- * changed by setting a print callback with
- * eina_error_print_cb_set(). Some print callbacks are already
- * defined: eina_error_print_cb_stdout() that send the message to
- * stdout and eina_error_print_cb_file() that sends it to a file, but
- * custom print callbacks can be used. They must be of type
- * #Eina_Error_Print_Cb.
+ * @deprecated use eina_log_print() instead.
  */
-EAPI void eina_error_print(Eina_Error_Level level, const char *file,
+EAPI void eina_error_print(int level, const char *file,
                const char *fnc, int line, const char *fmt, ...)
 {
        va_list args;
 
-       if (level > _error_level)
-               return;
-
        EINA_SAFETY_ON_NULL_RETURN(file);
        EINA_SAFETY_ON_NULL_RETURN(fnc);
        EINA_SAFETY_ON_NULL_RETURN(fmt);
 
+       EINA_LOG_WARN("this function is deprecated!");
+
        va_start(args, fmt);
-       _print_cb(level, file, fnc, line, fmt, _print_cb_data, args);
+       eina_log_vprint(EINA_LOG_DOMAIN_GLOBAL, level, file, fnc, line, fmt, args);
        va_end(args);
-
-       if (getenv("EINA_ERROR_ABORT")) abort();
 }
 
-EAPI void eina_error_vprint(Eina_Error_Level level, const char *file,
+/**
+ * @deprecated use eina_log_vprint() instead.
+ */
+EAPI void eina_error_vprint(int level, const char *file,
                const char *fnc, int line, const char *fmt, va_list args)
 {
-       if (level > _error_level)
-               return;
-
        EINA_SAFETY_ON_NULL_RETURN(file);
        EINA_SAFETY_ON_NULL_RETURN(fnc);
        EINA_SAFETY_ON_NULL_RETURN(fmt);
 
-       _print_cb(level, file, fnc, line, fmt, _print_cb_data, args);
-
-       if (getenv("EINA_ERROR_ABORT")) abort();
-}
-
-/**
- * @brief Print callback that sends the error message to stdout.
- *
- * @param level The error level.
- * @param file The name of the file where the error occurred.
- * @param fnc The name of the function where the error occurred.
- * @param line The number of the line where the error occurred.
- * @param fmt The format to use.
- * @param data Unused.
- * @param args The arguments that will be converted.
- *
- * This function is used to send a formatted error message to standard
- * output and is used as a print callback, with
- * eina_error_print(). This is the default print callback.
- */
-EAPI void eina_error_print_cb_stdout(Eina_Error_Level level, const char *file,
-               const char *fnc, int line, const char *fmt, __UNUSED__ void *data,
-               va_list args)
-{
-       printf("%s", _colors[level]);
-       printf("[%s:%d] %s() ", file, line, fnc);
-       printf("%s", _colors[EINA_ERROR_LEVEL_INFO]);
-       vprintf(fmt, args);
-}
-
-/**
- * @brief Print callback that sends the error message to a specified stream.
- *
- * @param level Unused.
- * @param file The name of the file where the error occurred.
- * @param fnc The name of the function where the error occurred.
- * @param line The number of the line where the error occurred.
- * @param fmt The format to use.
- * @param data The file stream.
- * @param args The arguments that will be converted.
- *
- * This function is used to send a formatted error message to the
- * stream specified by @p data. That stream must be of type FILE *. Look
- * at eina_error_print_cb_stdout() for the description of the other
- * parameters. Use eina_error_print_cb_set() to set it as default
- * print callback in eina_error_print().
- */
-EAPI void eina_error_print_cb_file(__UNUSED__ Eina_Error_Level level, const char *file,
-               const char *fnc, int line, const char *fmt, void *data,
-               va_list args)
-{
-       FILE *f = data;
+       EINA_LOG_WARN("this function is deprecated!");
 
-       fprintf(f, "[%s:%d] %s() ", file, line, fnc);
-       vfprintf(f, fmt, args);
+       eina_log_vprint(EINA_LOG_DOMAIN_GLOBAL, level, file, fnc, line, fmt, args);
 }
 
 /**
- * @brief Set the default print callback.
- *
- * @param cb The print callback.
- * @param data The data to pass to the callback
- *
- * This function sets the default print callback @p cb used by
- * eina_error_print(). A data can be passed to that callback with
- * @p data.
- */
-EAPI void eina_error_print_cb_set(Eina_Error_Print_Cb cb, void *data)
-{
-       _print_cb = cb;
-       _print_cb_data = data;
-}
-
-/**
- * @brief Set the default error log level.
- *
- * @param level The error level.
- *
- * This function sets the error log level @p level. It is used in
- * eina_error_print().
+ * @deprecated use eina_log_level_set() instead.
  */
-EAPI void eina_error_log_level_set(Eina_Error_Level level)
+EAPI void eina_error_log_level_set(int level)
 {
-       _error_level = level;
+   EINA_LOG_WARN("this function is deprecated!");
+   eina_log_level_set(level);
 }
 
 /**
index 89f2672..19c29b9 100644 (file)
@@ -31,6 +31,7 @@
 #include "eina_private.h"
 #include "eina_error.h"
 #include "eina_inlist.h"
+#include "eina_log.h"
 #include "eina_magic.h"
 
 /*============================================================================*
@@ -225,44 +226,47 @@ EAPI void
 eina_magic_fail(void *d, Eina_Magic m, Eina_Magic req_m, const char *file, const char *fnc, int line)
 {
    if (!d)
-     eina_error_print(EINA_ERROR_LEVEL_ERR, file, fnc, line,
+     eina_log_print(EINA_LOG_DOMAIN_GLOBAL, EINA_LOG_LEVEL_CRITICAL,
+                   file, fnc, line,
+                   "*** Eina Magic Check Failed !!!\n"
+                   "    Input handle pointer is NULL !\n"
+                   "*** NAUGHTY PROGRAMMER!!!\n"
+                   "*** SPANK SPANK SPANK!!!\n"
+                   "*** Now go fix your code. Tut tut tut!\n"
+                   "\n");
+   else
+     if (m == EINA_MAGIC_NONE)
+       eina_log_print(EINA_LOG_DOMAIN_GLOBAL, EINA_LOG_LEVEL_CRITICAL,
+                     file, fnc, line,
                      "*** Eina Magic Check Failed !!!\n"
-                     "    Input handle pointer is NULL !\n"
+                     "    Input handle has already been freed!\n"
                      "*** NAUGHTY PROGRAMMER!!!\n"
-                     "*** SPANK SPANK SPANK!!!\n"
-                     "*** Now go fix your code. Tut tut tut!\n"
+                     "*** SPANK SPANK SPANK!!!\n"
+                     "*** Now go fix your code. Tut tut tut!\n"
                      "\n");
-   else
-     if (m == EINA_MAGIC_NONE)
-       eina_error_print(EINA_ERROR_LEVEL_ERR, file, fnc, line,
-                       "*** Eina Magic Check Failed !!!\n"
-                       "    Input handle has already been freed!\n"
-                       "*** NAUGHTY PROGRAMMER!!!\n"
-                       "*** SPANK SPANK SPANK!!!\n"
-                       "*** Now go fix your code. Tut tut tut!\n"
-                       "\n");
      else
        if (m != req_m)
-        eina_error_print(EINA_ERROR_LEVEL_ERR, file, fnc, line,
-                         "*** Eina Magic Check Failed !!!\n"
-                         "    Input handle is wrong type\n"
-                         "    Expected: %08x - %s\n"
-                         "    Supplied: %08x - %s\n"
-                         "*** NAUGHTY PROGRAMMER!!!\n"
-                         "*** SPANK SPANK SPANK!!!\n"
-                         "*** Now go fix your code. Tut tut tut!\n"
-                         "\n",
-                         req_m, eina_magic_string_get(req_m),
-                         m, eina_magic_string_get(m));
+       eina_log_print(EINA_LOG_DOMAIN_GLOBAL, EINA_LOG_LEVEL_CRITICAL,
+                     file, fnc, line,
+                     "*** Eina Magic Check Failed !!!\n"
+                     "    Input handle is wrong type\n"
+                     "    Expected: %08x - %s\n"
+                     "    Supplied: %08x - %s\n"
+                     "*** NAUGHTY PROGRAMMER!!!\n"
+                     "*** SPANK SPANK SPANK!!!\n"
+                     "*** Now go fix your code. Tut tut tut!\n"
+                     "\n",
+                     req_m, eina_magic_string_get(req_m),
+                     m, eina_magic_string_get(m));
        else
-        eina_error_print(EINA_ERROR_LEVEL_ERR, file, fnc, line,
-                         "*** Eina Magic Check Failed !!!\n"
-                         "    Why did you call me !\n"
-                         "*** NAUGHTY PROGRAMMER!!!\n"
-                         "*** SPANK SPANK SPANK!!!\n"
-                         "*** Now go fix your code. Tut tut tut!\n"
-                         "\n");
-   if (getenv("EINA_ERROR_ABORT")) abort();
+       eina_log_print(EINA_LOG_DOMAIN_GLOBAL, EINA_LOG_LEVEL_CRITICAL,
+                     file, fnc, line,
+                     "*** Eina Magic Check Failed !!!\n"
+                     "    Why did you call me !\n"
+                     "*** NAUGHTY PROGRAMMER!!!\n"
+                     "*** SPANK SPANK SPANK!!!\n"
+                     "*** Now go fix your code. Tut tut tut!\n"
+                     "\n");
 }
 
 /**
index 233edfc..8e5dc76 100644 (file)
@@ -61,26 +61,9 @@ START_TEST(eina_error_errno)
 }
 END_TEST
 
-START_TEST(eina_error_macro)
-{
-   eina_error_init();
-
-   eina_error_log_level_set(EINA_ERROR_LEVEL_DBG);
-   eina_error_print_cb_set(eina_error_print_cb_file, stderr);
-
-   EINA_ERROR_PERR("An error\n");
-   EINA_ERROR_PINFO("An info\n");
-   EINA_ERROR_PWARN("A warning\n");
-   EINA_ERROR_PDBG("A debug\n");
-
-   eina_error_shutdown();
-}
-END_TEST
-
 void
 eina_test_error(TCase *tc)
 {
    tcase_add_test(tc, eina_error_init_shutdown);
    tcase_add_test(tc, eina_error_errno);
-   tcase_add_test(tc, eina_error_macro);
 }