open-vm-tools 10.0.0
log.h
Go to the documentation of this file.
1 /*********************************************************
2  * Copyright (C) 2011-2015 VMware, Inc. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation version 2.1 and no later version.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
11  * License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16  *
17  *********************************************************/
18 
19 #ifndef _VMTOOLS_LOG_H_
20 #define _VMTOOLS_LOG_H_
21 
136 #if !defined(G_LOG_DOMAIN)
137 # error "G_LOG_DOMAIN must be defined."
138 #endif
139 
140 #include <glib.h>
141 
142 #if defined(__GNUC__)
143 # define FUNC __func__
144 #else
145 # define FUNC __FUNCTION__
146 #endif
147 
148 /*
149  *******************************************************************************
150  * g_info -- */
160 #if !defined(g_info)
161 # define g_info(fmt, ...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__)
162 #endif
163 
165 #ifdef VMX86_DEBUG
166 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "info"
167 #else
168 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "message"
169 #endif
170 
171 
172 /*
173  *******************************************************************************
174  * vm_{critical,debug,error,info,message,warning} -- */
186 #define vm_critical(fmt, ...) g_critical("%s: " fmt, FUNC, ## __VA_ARGS__)
187 
189 #define vm_debug(fmt, ...) g_debug("%s: " fmt, FUNC, ## __VA_ARGS__)
190 
192 #define vm_error(fmt, ...) g_error("%s: " fmt, FUNC, ## __VA_ARGS__)
193 
195 #define vm_info(fmt, ...) g_info("%s: " fmt, FUNC, ## __VA_ARGS__)
196 
198 #define vm_message(fmt, ...) g_message("%s: " fmt, FUNC, ## __VA_ARGS__)
199 
201 #define vm_warning(fmt, ...) g_warning("%s: " fmt, FUNC, ## __VA_ARGS__)
202 
203 G_BEGIN_DECLS
204 
205 void
206 VMTools_ConfigLogging(const gchar *defaultDomain,
207  GKeyFile *cfg,
208  gboolean force,
209  gboolean reset);
210 
211 G_END_DECLS
212 
215 #endif /* _VMTOOLS_LOG_H_ */
216 
G_BEGIN_DECLS void VMTools_ConfigLogging(const gchar *defaultDomain, GKeyFile *cfg, gboolean force, gboolean reset)
Definition: vmtoolsLog.c:974