RmpLogger.h
Go to the documentation of this file.
00001 /*
00002   COPYRIGHT (c) 2014 SEGWAY Inc.
00003 
00004   Software License Agreement:
00005 
00006   The software supplied herewith by Segway Inc. (the "Company") for its 
00007   RMP Robotic Platforms is intended and supplied to you, the Company's 
00008   customer, for use solely and exclusively with Segway products. The 
00009   software is owned by the Company and/or its supplier, and is protected 
00010   under applicable copyright laws.  All rights are reserved. Any use in 
00011   violation of the foregoing restrictions may subject the user to criminal
00012   sanctions under applicable laws, as well as to civil liability for the 
00013   breach of the terms and conditions of this license. The Company may 
00014   immediately terminate this Agreement upon your use of the software with 
00015   any products that are not Segway products.
00016 
00017   You shall indemnify, defend and hold the Company harmless from any claims, 
00018   demands, liabilities or expenses, including reasonable attorneys fees, incurred 
00019   by the Company as a result of any claim or proceeding against the Company 
00020   arising out of or based upon: 
00021 
00022   (i) The combination, operation or use of the software by you with any hardware, 
00023       products, programs or data not supplied or approved in writing by the Company, 
00024       if such claim or proceeding would have been avoided but for such combination, 
00025       operation or use.
00026 
00027   (ii) The modification of the software by or on behalf of you.
00028 
00029   (iii) Your use of the software.
00030 
00031   THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
00032   WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
00033   TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00034   PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
00035   IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
00036   CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00037 */
00038 
00039 #ifndef RMP_LOGGER_H
00040 #define RMP_LOGGER_H
00041 
00042 #include <string>
00043 #include <ostream>
00044 #include <sstream>
00045 #include <memory>
00046 
00047 namespace segway
00048 {
00052   enum LogLevel
00053   {
00054     DEBUG = 0,
00055     INFO,
00056     WARNING,
00057     ERROR,
00058     FATAL
00059   };
00060 
00064   class Logger
00065   {
00066   public:
00071     static void SetMinLogLevel(LogLevel level);
00072 
00077     static void AddOutputStream(std::ostream& rOutputStream);
00078 
00083     static void AddLogFile(const std::string& rFileName);
00084 
00090     static void Log(LogLevel level, const std::string& rMessage);
00091     
00092   private:
00101     Logger();
00102 
00106     Logger(const Logger&);
00107 
00111     Logger& operator=(const Logger&);
00112 
00116     ~Logger();
00117 
00118   private:
00122     class Impl;
00123     std::unique_ptr<Impl> m_pImpl;
00124   };
00125   
00126 } // namespace segway
00127 
00131 #define SEGWAY_LOG(level, args) \
00132   std::stringstream stringStream; \
00133   stringStream << args; \
00134   std::string message = stringStream.str(); \
00135   segway::Logger::Log(level, message);
00136 
00137 #endif // RMP_LOGGER_H


rmp_base
Author(s):
autogenerated on Wed Aug 26 2015 16:24:39