DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
include/logging.h
00001 /*
00002  *  Copyright (C) 2002-2015  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef DOSBOX_LOGGING_H
00020 #define DOSBOX_LOGGING_H
00021 
00022 #include <stdio.h>
00023 #include "setup.h"
00024 
00025 enum LOG_TYPES {
00026         LOG_ALL,
00027         LOG_VGA, LOG_VGAGFX,LOG_VGAMISC,LOG_INT10,
00028         LOG_SB,LOG_DMACONTROL,
00029         LOG_FPU,LOG_CPU,LOG_PAGING,
00030         LOG_FCB,LOG_FILES,LOG_IOCTL,LOG_EXEC,LOG_DOSMISC,
00031         LOG_PIT,LOG_KEYBOARD,LOG_PIC,
00032         LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC,
00033         LOG_IO,
00034         LOG_PCI,
00035         LOG_VOODOO,
00036         LOG_MAX
00037 };
00038 
00039 enum LOG_SEVERITIES {
00040         LOG_DEBUG,
00041         LOG_NORMAL,
00042         LOG_WARN,
00043         LOG_ERROR,
00044         LOG_FATAL,
00045         LOG_NEVER
00046 };
00047 
00048 struct _LogGroup {
00049         char const* front;
00050         enum LOG_SEVERITIES min_severity;
00051 };
00052 
00053 extern _LogGroup loggrp[LOG_MAX];
00054 extern FILE* debuglog;
00055 
00056 class LOG 
00057 { 
00058         LOG_TYPES       d_type;
00059         LOG_SEVERITIES  d_severity;
00060 public:
00061 
00062         LOG (LOG_TYPES type , LOG_SEVERITIES severity):
00063                 d_type(type),
00064                 d_severity(severity)
00065                 {}
00066 
00067         static void ParseEnableSetting(_LogGroup &group,const char *setting);
00068         static void SetupConfigSection(void);
00069         static void EarlyInit();
00070         static void Init();
00071         static void Exit();
00072 
00073         void operator() (char const* buf, ...) GCC_ATTRIBUTE(__format__(__printf__, 2, 3));  //../src/debug/debug_gui.cpp
00074 };
00075 
00076 void                                    DEBUG_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2));
00077 
00078 #define LOG_MSG                         DEBUG_ShowMsg
00079 
00080 #endif //DOSBOX_LOGGING_H
00081