src/log.h

Go to the documentation of this file.
00001 //
00002 // Unihan Input Method
00003 //
00004 // Copyright © 2002-2007 Sun Wah Linux Ltd.
00005 //
00006 //
00007 // This library is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU Lesser General Public License as
00009 // published by the Free Software Foundation; either version 2.1 of the
00010 // License, or (at your option) any later version.
00011 //
00012 // This library is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this program; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020 // USA
00021 //
00022 // $Id: unihan2.c 769 2007-05-14 03:39:06Z roger $
00023 //
00024 
00025 
00026 #ifndef __LOG_H
00027 #define __LOG_H
00028 
00029 #include <stdarg.h>
00030 
00031 typedef enum {
00032     LOG_LEVEL_ERROR     = 1 << 2,
00033     LOG_LEVEL_CRITICAL  = 1 << 3,
00034     LOG_LEVEL_WARNING   = 1 << 4,
00035     LOG_LEVEL_MESSAGE   = 1 << 5,
00036     LOG_LEVEL_INFO      = 1 << 6,
00037     LOG_LEVEL_DEBUG     = 1 << 7
00038 } LogLevelFlags;
00039 
00040 void unihan_logv(const char *log_domain, LogLevelFlags log_level, const char *format, va_list args);
00041 void unihan_log(const char *log_domain, LogLevelFlags log_level, const char *format, ...);
00042 
00043 void unihan_log_set_stdout(FILE *stdout_fd);
00044 void unihan_log_set_stderr(FILE *stderr_fd);
00045 
00046 void unihan_log_init(void);
00047 
00048 #ifndef LOG_DOMAIN
00049 #define LOG_DOMAIN  ((char *)NULL)
00050 #endif
00051 
00052 #define unihan_error(...)       unihan_log(LOG_DOMAIN, LOG_LEVEL_ERROR, __VA_ARGS__)
00053 #define unihan_critical(...)    unihan_log(LOG_DOMAIN, LOG_LEVEL_CRITICAL, __VA_ARGS__)
00054 #define unihan_warning(...)     unihan_log(LOG_DOMAIN, LOG_LEVEL_WARNING, __VA_ARGS__)
00055 #define unihan_message(...)     unihan_log(LOG_DOMAIN, LOG_LEVEL_MESSAGE, __VA_ARGS__)
00056 #define unihan_debug(...)       unihan_log(LOG_DOMAIN, LOG_LEVEL_DEBUG, __VA_ARGS__)
00057 
00058 #endif /* __LOG_H */
00059 
00060 // vi:ts=4:sw=4:nowrap:cin:expandtab

Generated on Fri Sep 7 15:51:41 2007 for unihan-core-le by  doxygen 1.5.2