22726e4d |
1 | /****************************************************************************** |
2 | * Arachnoid Graphics Plugin for Mupen64Plus |
3 | * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ |
4 | * |
5 | * Copyright (C) 2009 Jon Ring |
6 | * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson |
7 | * |
8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License |
10 | * as published by the Free Software Foundation; either version 2 |
11 | * of the License, or (at your option) any later version. |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
21 | *****************************************************************************/ |
22 | |
23 | #ifndef LOGGER_H_ |
24 | #define LOGGER_H_ |
25 | |
26 | #include <cstdlib> |
27 | #include "m64p_types.h" |
28 | |
29 | //***************************************************************************** |
30 | //***************************************************************************** |
31 | //* Log |
32 | //! Class for sending log messages to M64P |
33 | //***************************************************************************** |
34 | class Logger |
35 | { |
36 | public: |
37 | //Destructor |
38 | ~Logger(); |
39 | |
40 | //Singleton Instance |
41 | static Logger& getSingleton() |
42 | { |
43 | static Logger pInstance; |
44 | return pInstance; |
45 | } |
46 | |
47 | //Initialize / Dispose |
48 | bool initialize(void (*debugCallback)(void*, int, const char*), void *context); |
49 | void dispose(); |
50 | |
51 | //Message |
52 | void printMsg(const char* msg, m64p_msg_level lml=M64MSG_VERBOSE); |
53 | |
54 | protected: |
55 | //! Constructor |
56 | Logger() { m_debugCallback = NULL; m_debugCallContext = NULL; } |
57 | |
58 | protected: |
59 | void (*m_debugCallback)(void *, int, const char *); |
60 | void *m_debugCallContext; |
61 | }; |
62 | |
63 | #endif |