open-vm-tools 10.0.5
|
00001 /********************************************************* 00002 * Copyright (C) 2011-2015 VMware, Inc. All rights reserved. 00003 * 00004 * This program is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License as published 00006 * by the Free Software Foundation version 2.1 and no later version. 00007 * 00008 * This program is distributed in the hope that it will be useful, but 00009 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00010 * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public 00011 * License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this program; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 00016 * 00017 *********************************************************/ 00018 00019 #ifndef _VMTOOLS_LOG_H_ 00020 #define _VMTOOLS_LOG_H_ 00021 00136 #if !defined(G_LOG_DOMAIN) 00137 # error "G_LOG_DOMAIN must be defined." 00138 #endif 00139 00140 #include <glib.h> 00141 00142 #if defined(__GNUC__) 00143 # define FUNC __func__ 00144 #else 00145 # define FUNC __FUNCTION__ 00146 #endif 00147 00148 /* 00149 ******************************************************************************* 00150 * g_info -- */ 00160 #if !defined(g_info) 00161 # define g_info(fmt, ...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__) 00162 #endif 00163 00165 #ifdef VMX86_DEBUG 00166 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "info" 00167 #else 00168 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "message" 00169 #endif 00170 00171 00172 /* 00173 ******************************************************************************* 00174 * vm_{critical,debug,error,info,message,warning} -- */ 00186 #define vm_critical(fmt, ...) g_critical("%s: " fmt, FUNC, ## __VA_ARGS__) 00187 00189 #define vm_debug(fmt, ...) g_debug("%s: " fmt, FUNC, ## __VA_ARGS__) 00190 00192 #define vm_error(fmt, ...) g_error("%s: " fmt, FUNC, ## __VA_ARGS__) 00193 00195 #define vm_info(fmt, ...) g_info("%s: " fmt, FUNC, ## __VA_ARGS__) 00196 00198 #define vm_message(fmt, ...) g_message("%s: " fmt, FUNC, ## __VA_ARGS__) 00199 00201 #define vm_warning(fmt, ...) g_warning("%s: " fmt, FUNC, ## __VA_ARGS__) 00202 00203 G_BEGIN_DECLS 00204 00205 void 00206 VMTools_ConfigLogging(const gchar *defaultDomain, 00207 GKeyFile *cfg, 00208 gboolean force, 00209 gboolean reset); 00210 00211 G_END_DECLS 00212 00215 #endif /* _VMTOOLS_LOG_H_ */ 00216