Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# OgreLog.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023
    00024 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029
    00030 #ifndef __Log_H__
    00031 #define __Log_H__
    00032
    00033 #include "OgrePrerequisites.h"
    00034
    00035 namespace Ogre {
    00036
    00037     // LogMessageLevel + LoggingLevel > OGRE_LOG_THRESHOLD = message logged
    00038     #define OGRE_LOG_THRESHOLD 4
    00039
    00042     enum LoggingLevel
    00043     {
    00044         LL_LOW = 1,
    00045         LL_NORMAL = 2,
    00046         LL_BOREME = 3
    00047     };
    00048
    00051     enum LogMessageLevel
    00052     {
    00053         LML_TRIVIAL = 1,
    00054         LML_NORMAL = 2,
    00055         LML_CRITICAL = 3
    00056     };
    00057
    00059     class LogListener
    00060     {
    00061     public:
    00062         virtual ~LogListener() {};
    00063
    00076         virtual void messageLogged( const String& message, LogMessageLevel lml, bool maskDebug, const String &logName ) = 0;
    00077     };
    00078
    00085     class _OgreExport Log
    00086     {
    00087     protected:
    00088         std::ofstream   mfpLog;
    00089         LoggingLevel    mLogLevel;
    00090         bool            mDebugOut;
    00091         bool            mSuppressFile;
    00092         String          mLogName;
    00093
    00094         typedef std::vector<LogListener*> mtLogListener;
    00095         mtLogListener mListeners;
    00096
    00097     public:
    00098         OGRE_AUTO_MUTEX // public to allow external locking
    00103         Log( const String& name, bool debugOutput = true, bool suppressFileOutput = false);
    00104
    00109         ~Log();
    00110
    00112         const String& getName() const { return mLogName; }
    00114         bool isDebugOutputEnabled() const { return mDebugOut; }
    00116         bool isFileOutputSuppressed() const { return mSuppressFile; }
    00117
    00121         void logMessage( const String& message, LogMessageLevel lml = LML_NORMAL, bool maskDebug = false );
    00122
    00127         void setLogDetail(LoggingLevel ll);
    00130         LoggingLevel getLogDetail() const { return mLogLevel; }
    00137         void addListener(LogListener* listener);
    00138
    00145         void removeListener(LogListener* listener);
    00146     };
    00147 }
    00148
    00149 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 30 10:50:57 2007