PANDORA: Make GLES context compatible with latest driver (FB only, no X11)
[mupen64plus-pandora.git] / source / mupen64plus-video-arachnoid / src / log / Logger.cpp
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 #include "Logger.h"
24
25 //-----------------------------------------------------------------------------
26 //* Initialize
27 //! Initializes log with debug callback
28 //-----------------------------------------------------------------------------
29 bool Logger::initialize(void (*debugCallback)(void*, int, const char*), void *context)
30 {
31     m_debugCallback = debugCallback;
32     m_debugCallContext = context;
33
34     return true;
35 }
36
37 //-----------------------------------------------------------------------------
38 //! Destructor
39 //-----------------------------------------------------------------------------
40 Logger::~Logger()
41 {
42     dispose();
43 }
44
45 //-----------------------------------------------------------------------------
46 //* Dispose
47 //! Closes log file
48 //-----------------------------------------------------------------------------
49 void Logger::dispose()
50 {
51     m_debugCallback = NULL;
52     m_debugCallContext = NULL;
53 }
54
55 //-----------------------------------------------------------------------------
56 //* Print Message
57 //! Writes a message to log-file and/or console.
58 //! @param msg The text message to write to log-file.
59 //! @param lml How important the message is. Error message are more important then warnings for example.
60 //-----------------------------------------------------------------------------
61 void Logger::printMsg(const char* msg, m64p_msg_level lml)
62 {
63     if (m_debugCallback != NULL)
64     {
65         (*m_debugCallback)(m_debugCallContext, lml, msg);
66     }    
67 }