please comment.
---------- Forwarded message ---------- From: Enlightenment SVN <[email protected]> Date: Thu, Sep 3, 2009 at 9:57 PM Subject: E SVN: barbieri IN trunk/eina/src: include lib To: [email protected] Log: eina_log_vprint() for those that want to wrap it in other functions. Author: barbieri Date: 2009-09-03 17:57:09 -0700 (Thu, 03 Sep 2009) New Revision: 42216 Modified: trunk/eina/src/include/eina_log.h trunk/eina/src/lib/eina_log.c Modified: trunk/eina/src/include/eina_log.h =================================================================== --- trunk/eina/src/include/eina_log.h 2009-09-04 00:56:16 UTC (rev 42215) +++ trunk/eina/src/include/eina_log.h 2009-09-04 00:57:09 UTC (rev 42216) @@ -192,7 +192,16 @@ EAPI int eina_log_domain_register(const char *name, const char *color) EINA_ARG_NONNULL(1); EAPI void eina_log_domain_unregister(int domain); +/* + * Logging functions. + */ EAPI void eina_log_print(int domain, Eina_Log_Level level, const char *file, const char *function, int line, const char *fmt, ...) EINA_ARG_NONNULL(2, 3, 5); +EAPI void eina_log_vprint(int domain, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, va_list args) EINA_ARG_NONNULL(2, 3, 5); + + +/* + * Logging methods (change how logging is done). + */ EAPI void eina_log_print_cb_stdout(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args); EAPI void eina_log_print_cb_stderr(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args); EAPI void eina_log_print_cb_file(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args); Modified: trunk/eina/src/lib/eina_log.c =================================================================== --- trunk/eina/src/lib/eina_log.c 2009-09-04 00:56:16 UTC (rev 42215) +++ trunk/eina/src/lib/eina_log.c 2009-09-04 00:57:09 UTC (rev 42216) @@ -1206,3 +1206,53 @@ UNLOCK(); va_end(args); } + +/** + * Print out log message using given domain and level. + * + * @note Usually you'll not use this function directly but the helper + * macros EINA_LOG(), EINA_LOG_DOM_CRIT(), EINA_LOG_CRIT() and + * so on. See eina_log.h + * + * @param domain logging domain to use or @c EINA_LOG_DOMAIN_GLOBAL if + * you registered none. It is recommended that modules and + * applications have their own logging domain. + * @param level message level, those with level greater than user + * specified value (eina_log_level_set() or environment + * variables EINA_LOG_LEVEL, EINA_LOG_LEVELS) will be ignored. + * @param file filename that originated the call, must @b not be @c NULL. + * @param fnc function that originated the call, must @b not be @c NULL. + * @param line originating line in @a file. + * @param fmt printf-like format to use. Should not provide trailing + * '\n' as it is automatically included. + * + * @note MT: this function may be called from different threads if + * eina_log_threads_enable() was called before. + * + * @see eina_log_print() + */ +EAPI void +eina_log_vprint(int domain, Eina_Log_Level level, const char *file, + const char *fnc, int line, const char *fmt, va_list args) +{ +#ifdef EINA_SAFETY_CHECKS + if (EINA_UNLIKELY(file == NULL)) + { + fputs("ERR: eina_log_print() file == NULL\n", stderr); + return; + } + if (EINA_UNLIKELY(fnc == NULL)) + { + fputs("ERR: eina_log_print() fnc == NULL\n", stderr); + return; + } + if (EINA_UNLIKELY(fmt == NULL)) + { + fputs("ERR: eina_log_print() fmt == NULL\n", stderr); + return; + } +#endif + LOCK(); + eina_log_print_unlocked(domain, level, file, fnc, line, fmt, args); + UNLOCK(); +} ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ enlightenment-svn mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-svn -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: [email protected] Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
