static bool __mm_util_check_angle(mm_util_magick_rotate_type angle);
+static void __mm_util_magick_log_method(const ExceptionType excep, const char *message)
+{
+ /* To exclude time, user time and pid */
+ unsigned int start_idx = 31;
+
+ if ((message == NULL) || (strlen(message) < start_idx)) {
+ start_idx = 0;
+ }
+
+ if (excep >= ErrorException)
+ mm_util_error("[GM][Ex:%3u] %s", excep, message + start_idx);
+ else if (excep >= WarningException)
+ mm_util_warn("[GM][Ex:%3u] %s", excep, message + start_idx);
+ else
+ mm_util_debug("[GM][Ex:%3u] %s", excep, message + start_idx);
+}
+
+static void __mm_util_magick_error_handler(const ExceptionType excep, const char *reason, const char *message)
+{
+ if (excep >= ErrorException)
+ mm_util_error("[GM][Ex:%3u][Rs:%s] %s", excep, reason, message);
+ else
+ mm_util_warn("[GM][Ex:%3u][Rs:%s] %s", excep, reason, message);
+}
+
static void __mm_util_init(ExceptionInfo *exception)
{
InitializeMagick(NULL);
-
if (exception != NULL)
GetExceptionInfo(exception);
+ /* set LogEventMask to show like "all" or "warning, error" */
+ /* <LogEventMask List>
+ * "none", "information", "warning", "error", "fatalerror", "configure", "annotate",
+ * "render", "transform", "locale", "coder", "x11", "cache", "blob", "deprecate",
+ * "user", "resource", "temporaryfile", "exception", "option", "all"
+ */
+#if (GMAGICK_DEBUG == 1)
+ SetLogEventMask("all");
+#else
+ SetLogEventMask("warning, error, fatalerror, exception");
+#endif
+ SetLogMethod(__mm_util_magick_log_method);
+ SetErrorHandler(__mm_util_magick_error_handler);
+ SetFatalErrorHandler(__mm_util_magick_error_handler);
+ SetWarningHandler(__mm_util_magick_error_handler);
+
return;
}