Logger.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: Logger.hpp 2967 2011-11-05 07:47:25Z yanweignss $"
00002 
00008 #ifndef GPSTK_LOGGER_HPP
00009 #define GPSTK_LOGGER_HPP
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //
00029 //  Wei Yan - Chinese Academy of Sciences . 2009~2015
00030 //
00031 //============================================================================
00032 
00033 #include <iostream>
00034 #include <map>
00035 #include <string>
00036 #include <cstdarg>
00037 #include "DayTime.hpp"
00038 #include "Exception.hpp"
00039 #include "Matrix.hpp"
00040 #include "LogMessage.hpp"
00041 #include "LogChannel.hpp"
00042 #include "MemoryUtils.hpp"
00043 #include "FormatUtils.hpp"
00044 #include "StreamBuf.hpp"
00045 
00046 namespace gpstk
00047 {
00048 
00049    class LogStream;
00050 
00051    class Logger
00052    {
00053    public:
00054       Logger(const Logger& right);
00055 
00056       Logger& operator = (const Logger& right);
00057 
00058       ~Logger(){};
00059 
00060       Logger& setChannelPattern(const std::string fmt="%t")
00061       { 
00062          if(this->channel) this->channel->setPattern(fmt); 
00063          return (*this);
00064       }
00065 
00066       Logger& setChannel(LogChannel* pChannel=&defaultChannel)
00067       { this->channel = pChannel; return (*this);}
00068       
00069       LogChannel* getChannel() const
00070       { return channel; }
00071      
00072       Logger& setLevel(int level)
00073       { this->level = level; return (*this);}
00074 
00075       void setLevel(const std::string& level);
00076 
00077       int getLevel() const
00078       { return this->level; }
00079 
00080       std::string getName()
00081       {return this->name; }
00082 
00083       void log(const std::string& text, LogLevel level);
00084 
00085       void log(const std::string& text, LogLevel level, ExceptionLocation location);
00086 
00087       void fatal(const std::string& msg)
00088       { log(msg,LEVEL_FATAL); }
00089 
00090       void critical(const std::string& msg)
00091       { log(msg,LEVEL_CRITICAL); }
00092 
00093       void error(const std::string& msg)
00094       { log(msg,LEVEL_ERROR); }
00095  
00096       void warning(const std::string& msg)
00097       { log(msg,LEVEL_WARNING); }
00098 
00099       void notice(const std::string& msg)
00100       { log(msg,LEVEL_NOTICE);}
00101  
00102       void information(const std::string& msg)
00103       { log(msg,LEVEL_INFORMATION); }
00104 
00105       void debug(const std::string& msg)
00106       { log(msg,LEVEL_DEBUG); } 
00107 
00108       void trace(const std::string& msg)
00109       { log(msg,LEVEL_TRACE); };
00110 
00111       bool is(int level) const
00112       { return level >= level;}
00113       
00114       bool fatal() const
00115       { return level >= LEVEL_FATAL; }
00116       
00117       bool critical() const
00118       { return level >= LEVEL_CRITICAL; }
00119       
00120       bool error() const
00121       { return level >= LEVEL_ERROR; }
00122       
00123       bool warning() const
00124       { return level >= LEVEL_WARNING; }
00125       
00126       bool notice() const
00127       { return level >= LEVEL_NOTICE; }
00128       
00129       bool information() const
00130       { return level >= LEVEL_INFORMATION; }
00131       
00132       bool debug() const
00133       { return level >= LEVEL_DEBUG; }
00134       
00135       bool trace() const
00136       { return level >= LEVEL_TRACE; }
00137 
00138       
00139       // static method
00140       //------------------
00141 
00142       static Logger& create( const std::string& logname,
00143                              LogChannel* logchannel = &defaultChannel,
00144                              LogLevel loglevel = LEVEL_INFORMATION);
00145          
00146       static void destroy(const std::string& name);
00147 
00148 
00149       static Logger& get(const std::string& name);
00150       
00151 
00152       static void shutdown();
00153 
00154 
00155       static Logger& nullLogger(const std::string& logname,
00156                                 LogLevel loglevel = LEVEL_INFORMATION, 
00157                                 const std::string& pattern = "%p: %t");
00158 
00159 
00160       static Logger& consoleLogger(const std::string& logname,
00161                            LogLevel loglevel = LEVEL_INFORMATION, 
00162                            const std::string& pattern = "%p: %t");
00163 
00164 
00165       static Logger& fileLogger(const std::string& logname,
00166                                 const std::string& filename,
00167                                 LogLevel loglevel = LEVEL_INFORMATION, 
00168                                 const std::string& pattern = "%p: %t");
00169      
00170    protected:
00171 
00172       void log(const LogMessage& msg);
00173       
00174       static Logger* find(const std::string& name);
00175       
00176       static void add(Logger* pLogger);
00177    
00178    protected:
00179       typedef std::map<std::string, Logger*> LoggerMap;
00180 
00181       Logger(){}
00182 
00183       Logger(const std::string& logname,
00184              LogLevel    loglevel   = LEVEL_INFORMATION, 
00185              LogChannel* logchannel = &defaultChannel) 
00186          : name(logname),level(loglevel), channel(logchannel) {}
00187 
00188       std::string   name;     
00189       int           level;    
00190       LogChannel*   channel;  
00191 
00192       static LoggerMap loggerMap;
00193       
00194 
00195    public:
00196       static ConsoleLogChannel defaultChannel;
00197       static AutoReleasePool<LogChannel> channelPool;
00198 
00199       friend class LogStreamBuf;
00200 
00201    }; // End of class 'Logger'
00202 
00203 
00204 
00205    template <class T>
00206    inline std::string mat2str(const Vector<T>& vec, size_t width, size_t digit,
00207                               std::string desc="")
00208    {
00209       std::ostringstream ss;
00210       ss << std::fixed;
00211       ss << "["<< vec.size() << "x1]: " << desc << std::endl;
00212       for(int i=0;i<vec.size();i++)
00213       {
00214          ss << " " << std::setw(width) << std::setprecision(digit) << vec[i];
00215          if((i+1)!=vec.size()) ss << std::endl;
00216       }      
00217       return ss.str();
00218    }
00219 
00220    template <class T>
00221    inline std::string mat2str(const Matrix<T>& mat, size_t width, size_t digit,
00222                               std::string desc="")
00223    {
00224       std::ostringstream ss;
00225       ss << std::fixed;
00226       ss << "["<< mat.rows()<<"x"<<mat.cols() <<"]: "<< desc << std::endl;
00227       ss << std::setw(width) << std::setprecision(digit) << mat;
00228       return ss.str();
00229    }
00230 
00231    //
00232    // convenience macros
00233    //
00234 #define GPSTK_LOGGER_STREAM(name) \
00235    LogStream( Logger::get(name) )
00236 
00237 #define GPSTK_NULL_LOGGER(name) \
00238    Logger::nullLogger(name)
00239 
00240 #define GPSTK_CONSOLE_LOGGER(name) \
00241    Logger::consoleLogger(name)
00242 
00243 #define GPSTK_FILE_LOGGER(name,file) \
00244    Logger::fileLogger(name,file)
00245 
00246 #define GPSTK_LOGGER_PATTERN(name,pattern) \
00247    Logger::get(name).setChannelPattern(pattern)
00248 
00249 #define GPSTK_LOGGER_LEVEL(name,level) \
00250    Logger::get(name).setLevel(name,level)
00251 
00252 
00253 #define GPSTK_FATAL(name, msg) \
00254    if (Logger::get(name).fatal()) Logger::get(name).log(msg, LEVEL_FATAL, FILE_LOCATION); else (void) 0
00255 
00256 #define GPSTK_FATAL_F1(name, fmt, arg1) \
00257    if (Logger::get(name).fatal()) Logger::get(name).log(FormatUtils::format((fmt), arg1), LEVEL_FATAL, FILE_LOCATION); else (void) 0
00258 
00259 #define GPSTK_FATAL_F2(name, fmt, arg1, arg2) \
00260    if (Logger::get(name).fatal()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_FATAL, FILE_LOCATION); else (void) 0
00261 
00262 #define GPSTK_FATAL_F3(name, fmt, arg1, arg2, arg3) \
00263    if (Logger::get(name).fatal()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_FATAL, FILE_LOCATION); else (void) 0
00264 
00265 #define GPSTK_FATAL_F4(name, fmt, arg1, arg2, arg3, arg4) \
00266    if (Logger::get(name).fatal()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_FATAL, FILE_LOCATION); else (void) 0
00267 
00268 #define GPSTK_FATAL_MAT(name, mat, w, d, desc) \
00269    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_FATAL, FILE_LOCATION); else (void) 0
00270 
00271 
00272 #define GPSTK_CRITICAL(name, msg) \
00273    if (Logger::get(name).critical()) Logger::get(name).log(msg, LEVEL_CRITICAL, FILE_LOCATION); else (void) 0
00274 
00275 #define GPSTK_CRITICAL_F1(name, fmt, arg1) \
00276    if (Logger::get(name).critical()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_CRITICAL, FILE_LOCATION); else (void) 0
00277 
00278 #define GPSTK_CRITICAL_F2(name, fmt, arg1, arg2) \
00279    if (Logger::get(name).critical()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_CRITICAL, FILE_LOCATION); else (void) 0
00280 
00281 #define GPSTK_CRITICAL_F3(name, fmt, arg1, arg2, arg3) \
00282    if (Logger::get(name).critical()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_CRITICAL, FILE_LOCATION); else (void) 0
00283 
00284 #define GPSTK_CRITICAL_F4(name, fmt, arg1, arg2, arg3, arg4) \
00285    if (Logger::get(name).critical()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_CRITICAL, FILE_LOCATION); else (void) 0
00286 
00287 #define GPSTK_CRITICAL_MAT(name, mat, w, d, desc) \
00288    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc),LEVEL_CRITICAL, FILE_LOCATION); else (void) 0
00289 
00290 
00291 #define GPSTK_ERROR(name, msg) \
00292    if (Logger::get(name).error()) Logger::get(name).log(msg, LEVEL_ERROR, FILE_LOCATION); else (void) 0
00293 
00294 #define GPSTK_ERROR_F1(name, fmt, arg1) \
00295    if (Logger::get(name).error()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_ERROR, FILE_LOCATION); else (void) 0
00296 
00297 #define GPSTK_ERROR_F2(name, fmt, arg1, arg2) \
00298    if (Logger::get(name).error()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_ERROR, FILE_LOCATION); else (void) 0
00299 
00300 #define GPSTK_ERROR_F3(name, fmt, arg1, arg2, arg3) \
00301    if (Logger::get(name).error()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_ERROR, FILE_LOCATION); else (void) 0
00302 
00303 #define GPSTK_ERROR_F4(name, fmt, arg1, arg2, arg3, arg4) \
00304    if (Logger::get(name).error()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_ERROR, FILE_LOCATION); else (void) 0
00305 
00306 #define GPSTK_ERROR_MAT(name, mat, w, d, desc) \
00307    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_ERROR, FILE_LOCATION); else (void) 0
00308 
00309 
00310 #define GPSTK_WARNING(name, msg) \
00311    if (Logger::get(name).warning()) Logger::get(name).log(msg, LEVEL_WARNING, FILE_LOCATION); else (void) 0
00312 
00313 #define GPSTK_WARNING_F1(name, fmt, arg1) \
00314    if (Logger::get(name).warning()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_WARNING, FILE_LOCATION); else (void) 0
00315 
00316 #define GPSTK_WARNING_F2(name, fmt, arg1, arg2) \
00317    if (Logger::get(name).warning()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_WARNING, FILE_LOCATION); else (void) 0
00318 
00319 #define GPSTK_WARNING_F3(name, fmt, arg1, arg2, arg3) \
00320    if (Logger::get(name).warning()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_WARNING, FILE_LOCATION); else (void) 0
00321 
00322 #define GPSTK_WARNING_F4(name, fmt, arg1, arg2, arg3, arg4) \
00323    if (Logger::get(name).warning()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_WARNING, FILE_LOCATION); else (void) 0
00324 
00325 #define GPSTK_WARNING_MAT(name, mat, w, d, desc) \
00326    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_WARNING, FILE_LOCATION); else (void) 0
00327    
00328 
00329 #define GPSTK_NOTICE(name, msg) \
00330    if (Logger::get(name).notice()) Logger::get(name).log(msg, LEVEL_NOTICE, FILE_LOCATION); else (void) 0
00331 
00332 #define GPSTK_NOTICE_F1(name, fmt, arg1) \
00333    if (Logger::get(name).notice()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_NOTICE, FILE_LOCATION); else (void) 0
00334 
00335 #define GPSTK_NOTICE_F2(name, fmt, arg1, arg2) \
00336    if (Logger::get(name).notice()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_NOTICE, FILE_LOCATION); else (void) 0
00337 
00338 #define GPSTK_NOTICE_F3(name, fmt, arg1, arg2, arg3) \
00339    if (Logger::get(name).notice()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_NOTICE, FILE_LOCATION); else (void) 0
00340 
00341 #define GPSTK_NOTICE_F4(name, fmt, arg1, arg2, arg3, arg4) \
00342    if (Logger::get(name).notice()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_NOTICE, FILE_LOCATION); else (void) 0
00343 
00344 #define GPSTK_NOTICE_MAT(name, mat, w, d, desc) \
00345    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_NOTICE, FILE_LOCATION); else (void) 0
00346 
00347 
00348 #define GPSTK_INFORMATION(name, msg) \
00349    if (Logger::get(name).information()) Logger::get(name).log(msg, LEVEL_INFORMATION, FILE_LOCATION); else (void) 0
00350 
00351 #define GPSTK_INFORMATION_F1(name, fmt, arg1) \
00352    if (Logger::get(name).information()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_INFORMATION, FILE_LOCATION); else (void) 0
00353 
00354 #define GPSTK_INFORMATION_F2(name, fmt, arg1, arg2) \
00355    if (Logger::get(name).information()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_INFORMATION, FILE_LOCATION); else (void) 0
00356 
00357 #define GPSTK_INFORMATION_F3(name, fmt, arg1, arg2, arg3) \
00358    if (Logger::get(name).information()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_INFORMATION, FILE_LOCATION); else (void) 0
00359 
00360 #define GPSTK_INFORMATION_F4(name, fmt, arg1, arg2, arg3, arg4) \
00361    if (Logger::get(name).information()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_INFORMATION, FILE_LOCATION); else (void) 0
00362 
00363 #define GPSTK_INFORMATION_MAT(name, mat, w, d, desc) \
00364    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_INFORMATION, FILE_LOCATION); else (void) 0
00365 
00366 #if defined(_DEBUG)
00367 
00368 #define GPSTK_DEBUG(name, msg) \
00369    if (Logger::get(name).debug()) Logger::get(name).log(msg, LEVEL_DEBUG, FILE_LOCATION); else (void) 0
00370 
00371 #define GPSTK_DEBUG_F1(name, fmt, arg1) \
00372    if (Logger::get(name).debug()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_DEBUG, FILE_LOCATION); else (void) 0
00373 
00374 #define GPSTK_DEBUG_F2(name, fmt, arg1, arg2) \
00375    if (Logger::get(name).debug()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_DEBUG, FILE_LOCATION); else (void) 0
00376 
00377 #define GPSTK_DEBUG_F3(name, fmt, arg1, arg2, arg3) \
00378    if (Logger::get(name).debug()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_DEBUG, FILE_LOCATION); else (void) 0
00379 
00380 #define GPSTK_DEBUG_F4(name, fmt, arg1, arg2, arg3, arg4) \
00381    if (Logger::get(name).debug()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_DEBUG, FILE_LOCATION); else (void) 0
00382 
00383 #define GPSTK_DEBUG_MAT(name, mat, w, d, desc) \
00384    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_DEBUG, FILE_LOCATION); else (void) 0
00385 
00386 
00387 #define GPSTK_TRACE(name, msg) \
00388    if (Logger::get(name).trace()) Logger::get(name).log(msg, LEVEL_TRACE, FILE_LOCATION); else (void) 0
00389 
00390 #define GPSTK_TRACE_F1(name, fmt, arg1) \
00391    if (Logger::get(name).trace()) Logger::get(name).log(FormatUtils::format((fmt), (arg1)), LEVEL_TRACE, FILE_LOCATION); else (void) 0
00392 
00393 #define GPSTK_TRACE_F2(name, fmt, arg1, arg2) \
00394    if (Logger::get(name).trace()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2)), LEVEL_TRACE, FILE_LOCATION); else (void) 0
00395 
00396 #define GPSTK_TRACE_F3(name, fmt, arg1, arg2, arg3) \
00397    if (Logger::get(name).trace()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3)), LEVEL_TRACE, FILE_LOCATION); else (void) 0
00398 
00399 #define GPSTK_TRACE_F4(name, fmt, arg1, arg2, arg3, arg4) \
00400    if (Logger::get(name).trace()) Logger::get(name).log(FormatUtils::format((fmt), (arg1), (arg2), (arg3), (arg4)), LEVEL_TRACE, FILE_LOCATION); else (void) 0
00401 
00402 #define GPSTK_TRACE_MAT(name, mat, w, d, desc) \
00403    if (Logger::get(name).fatal()) Logger::get(name).log(mat2str(mat,w,d,desc), LEVEL_TRACE, FILE_LOCATION); else (void) 0
00404 
00405 #else // #if defined(_DEBUG)
00406 
00407 #define GPSTK_DEBUG(name, msg)
00408 #define GPSTK_DEBUG_F1(name, fmt, arg1)
00409 #define GPSTK_DEBUG_F2(name, fmt, arg1, arg2)
00410 #define GPSTK_DEBUG_F3(name, fmt, arg1, arg2, arg3)
00411 #define GPSTK_DEBUG_F4(name, fmt, arg1, arg2, arg3, arg4)
00412 #define GPSTK_DEBUG_MAT(name, mat, w, d, desc)
00413 
00414 #define GPSTK_TRACE(name, msg)
00415 #define GPSTK_TRACE_F1(name, fmt, arg1)
00416 #define GPSTK_TRACE_F2(name, fmt, arg1, arg2)
00417 #define GPSTK_TRACE_F3(name, fmt, arg1, arg2, arg3)
00418 #define GPSTK_TRACE_F4(name, fmt, arg1, arg2, arg3, arg4)
00419 #define GPSTK_TRACE_MAT(name, mat, w, d, desc)
00420 
00421 #endif   // #if defined(_DEBUG)
00422 
00423 
00425 
00427 class LogStreamBuf: public StreamBuf   
00428 {
00429 public:
00430    LogStreamBuf(Logger& logger, LogLevel level)
00431       :_logger(logger),_level(level),_message("") {}
00432  
00433    ~LogStreamBuf(){}
00434 
00435    void setLevel(LogLevel level) { _level = level; }
00436 
00437    LogLevel getLevel() const { return _level; }
00438 
00439    Logger& logger() const { return _logger; }
00440 
00441    void setLogger(Logger& logger){_logger=logger;}
00442 
00443 private:
00444    int writeToDevice(char c)
00445    {
00446       if (c == '\n' || c == '\r')
00447       {
00448          LogMessage msg(_logger.name, _message, _level);
00449          _logger.log(msg);
00450 
00451          _message.clear();
00452       }
00453       else _message += c;
00454       return c;
00455    }
00456 
00457 private:
00458    Logger&           _logger;
00459    LogLevel          _level;
00460    std::string       _message;
00461 };
00462 
00463 
00464 class LogStream : public std::ostream
00465 {
00466 public:
00467    LogStream(Logger& logger, LogLevel level = LEVEL_INFORMATION)
00468       : _buf(logger,level), std::ostream(&_buf) {}
00469 
00470    LogStream(const std::string& loggerName, LogLevel level = LEVEL_INFORMATION)
00471       : _buf(Logger::get(loggerName),level), std::ostream(&_buf) {}
00472 
00473    LogStream(const LogStream& right)
00474       : _buf(right._buf.logger(),right._buf.getLevel()), std::ostream(&_buf) {}
00475 
00476    ~LogStream(){}
00477 
00478    LogStream& operator=(const LogStream& right)
00479    {
00480       _buf.setLogger(right._buf.logger());
00481       _buf.setLevel(right._buf.getLevel());
00482    }
00483 
00484    LogStream& fatal(){ return setLevel(LEVEL_FATAL);}
00485 
00486    LogStream& fatal(const std::string& message)
00487    { _buf.logger().log(message,LEVEL_FATAL); }
00488 
00489    LogStream& critical(){ return setLevel(LEVEL_CRITICAL);}
00490 
00491    LogStream& critical(const std::string& message)
00492    { _buf.logger().log(message,LEVEL_CRITICAL); }
00493 
00494    LogStream& error(){ return setLevel(LEVEL_ERROR);}
00495 
00496    LogStream& error(const std::string& message)
00497    { _buf.logger().log(message,LEVEL_ERROR); }
00498 
00499    LogStream& warning(){ return setLevel(LEVEL_WARNING);}
00500 
00501    LogStream& warning(const std::string& message)
00502    { _buf.logger().log(message,LEVEL_WARNING); }
00503 
00504    LogStream& notice(){ return setLevel(LEVEL_NOTICE);}
00505 
00506    LogStream& notice(const std::string& message)
00507    { _buf.logger().log(message,LEVEL_NOTICE); }
00508 
00509    LogStream& information(){ return setLevel(LEVEL_INFORMATION);}
00510 
00511    LogStream& information(const std::string& message)
00512    { _buf.logger().log(message,LEVEL_INFORMATION); }
00513 
00514    LogStream& debug(){ return setLevel(LEVEL_DEBUG);}
00515 
00516    LogStream& debug(const std::string& message)
00517    { _buf.logger().log(message,LEVEL_DEBUG); }
00518 
00519    LogStream& trace(){ return setLevel(LEVEL_TRACE);}
00520 
00521    LogStream& trace(const std::string& message)
00522    { _buf.logger().log(message,LEVEL_TRACE); }
00523 
00524    LogStream& setLevel(LogLevel level)
00525    { _buf.setLevel(level); return (*this); }
00526 
00527 
00528 protected:
00529    LogStreamBuf _buf;
00530 
00531 }; // End of method 'LogStream'
00532 
00533 
00534 }  // end of namespace 'gpstk'
00535 
00536 #endif   // GPSTK_LOGGER_HPP
00537 
00538 
00539 

Generated on Tue May 22 03:30:59 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1