1 /***************************************************************************** 2 * logger.hpp 3 ***************************************************************************** 4 * Copyright (C) 2003 the VideoLAN team 5 * $Id: caedc70e504d15581178a9675479035f975f1635 $ 6 * 7 * Authors: Cyril Deguet <asmax@via.ecp.fr> 8 * Olivier Teulière <ipkiss@via.ecp.fr> 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License along 21 * with this program; if not, write to the Free Software Foundation, Inc., 22 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 23 *****************************************************************************/ 24 25 #ifndef LOGGER_HPP 26 #define LOGGER_HPP 27 28 #include "skin_common.hpp" 29 #include <string> 30 31 32 // helper macros 33 #define MSG_ERR( msg ) Logger::instance( getIntf() )->error( msg ) 34 #define MSG_WARN( msg ) Logger::instance( getIntf() )->warn( msg ) 35 36 37 // Logger class 38 class Logger: public SkinObject 39 { 40 public: 41 /// Get the instance of Logger 42 /// Returns NULL if initialization failed 43 static Logger *instance( intf_thread_t *pIntf ); 44 45 /// Delete the instance of Logger 46 static void destroy( intf_thread_t *pIntf ); 47 48 /// Print an error message 49 void error( const std::string &rMsg ); 50 51 /// Print a warning 52 void warn( const std::string &rMsg ); 53 54 private: 55 // Private because it's a singleton 56 Logger( intf_thread_t *pIntf ); 57 ~Logger(); 58 }; 59 60 61 #endif 62