Ignore:
Timestamp:
16/12/2006 20:26:31 (5 years ago)
Author:
chris
Message:
  • Rename Loggers class to Logging, which looks nicer.
  • Fix type of "line" argument to loggers to int rather than std::string to match LINE
  • Define necessary static objects
  • Remove global condition on logging for now

(refs #3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/merge/lib/common/Logging.h

    r1224 r1225  
    1414#include <vector> 
    1515 
     16/* 
    1617#define BOX_LOG(level, stuff) \ 
    1718{ \ 
     
    2122        Log::Write(level, __FILE__, __LINE__, line.str()); \ 
    2223    } \ 
     24} 
     25*/ 
     26 
     27#define BOX_LOG(level, stuff) \ 
     28{ \ 
     29        std::ostringstream line; \ 
     30        line << stuff; \ 
     31        Logging::Log(level, __FILE__, __LINE__, line.str()); \ 
    2332} 
    2433 
     
    4251// Class 
    4352//              Name:    Logger 
    44 //              Purpose: Abstract class (interface) for log targets 
     53//              Purpose: Abstract base class for log targets 
    4554//              Created: 2006/12/16 
    4655// 
     
    5766         
    5867        virtual bool Log(Log::Level level, const std::string& rFile,  
    59                 const std::string& rLine, std::string& rMessage) = 0; 
     68                int line, std::string& rMessage) = 0; 
    6069         
    6170        void Filter(Log::Level level) 
     
    7584//              Name:    Console 
    7685//              Purpose: Console logging target 
    77 //              Created: 2006/12/12 
     86//              Created: 2006/12/16 
    7887// 
    7988// -------------------------------------------------------------------------- 
     
    8392        public: 
    8493        virtual bool Log(Log::Level level, const std::string& rFile,  
    85                 const std::string& rLine, std::string& rMessage); 
     94                int line, std::string& rMessage); 
    8695        virtual const char* GetType() { return "Console"; } 
    8796        virtual void SetProgramName(const std::string& rProgramName) { } 
     
    93102//              Name:    Syslog 
    94103//              Purpose: Syslog (or Windows Event Viewer) logging target 
    95 //              Created: 2006/12/12 
     104//              Created: 2006/12/16 
    96105// 
    97106// -------------------------------------------------------------------------- 
     
    104113         
    105114        virtual bool Log(Log::Level level, const std::string& rFile,  
    106                 const std::string& rLine, std::string& rMessage); 
     115                int line, std::string& rMessage); 
    107116        virtual const char* GetType() { return "Syslog"; } 
    108117        virtual void SetProgramName(const std::string& rProgramName); 
     
    112121// 
    113122// Class 
    114 //              Name:    Log 
     123//              Name:    Logging 
    115124//              Purpose: Static logging helper, keeps track of enabled loggers 
    116125//                       and distributes log messages to them. 
    117 //              Created: 2006/12/12 
     126//              Created: 2006/12/16 
    118127// 
    119128// -------------------------------------------------------------------------- 
    120129 
    121 class Loggers 
     130class Logging 
    122131{ 
    123132        private: 
     
    139148        static void Remove (Logger* pOldLogger); 
    140149        static void Log(Log::Level level, const std::string& rFile,  
    141                 const std::string& rLine, const std::string& rMessage); 
     150                int line, const std::string& rMessage); 
    142151        static void SetContext(std::string context); 
    143152        static void ClearContext(); 
Note: See TracChangeset for help on using the changeset viewer.