emu_log.h

Go to the documentation of this file.
00001 /********************************************************************************
00002  *                               libemu
00003  *
00004  *                    - x86 shellcode emulation -
00005  *
00006  *
00007  * Copyright (C) 2007  Paul Baecher & Markus Koetter
00008  * 
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License
00011  * as published by the Free Software Foundation; either version 2
00012  * of the License, or (at your option) any later version.
00013  * 
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022  * 
00023  * 
00024  *             contact nepenthesdev@users.sourceforge.net  
00025  *
00026  *******************************************************************************/
00027 
00028 #ifndef HAVE_EMU_LOG_H
00029 #define HAVE_EMU_LOG_H
00030 
00031 struct emu;
00032 
00033 enum emu_log_level
00034 {
00035         EMU_LOG_NONE,
00036         EMU_LOG_INFO,
00037         EMU_LOG_DEBUG
00038 };
00039 
00040 typedef void (*emu_log_logcb)(struct emu *e, enum emu_log_level level, const char *msg);
00041 
00042 struct emu_logging *emu_log_new(void);
00043 void emu_log_free(struct emu_logging *el);
00044 
00045 void emu_log_level_set(struct emu_logging *el, enum emu_log_level level);
00046 
00047 void emu_log(struct emu *e, enum emu_log_level level, const char *format, ...);
00048 
00049 void emu_log_set_logcb(struct emu_logging *el, emu_log_logcb logcb);
00050 
00051 void emu_log_default_logcb(struct emu *e, enum emu_log_level level, const char *msg);
00052 
00053 #define logInfo(e, format...) emu_log(e, EMU_LOG_INFO, format)
00054 
00055 #ifdef DEBUG
00056 #define logDebug(e, format...) emu_log(e, EMU_LOG_DEBUG, format)
00057 #else
00058 #define logDebug(e, format...)
00059 #endif // DEBUG
00060 
00061 #define logPF(e) logDebug(e, "in <%s> %s:%i>\n", __PRETTY_FUNCTION__, __FILE__,  __LINE__)
00062 
00063 #endif // HAVE_EMU_LOG_H

Generated on Sun Jan 9 16:47:44 2011 for libemu by  doxygen 1.6.1