Logger.hpp
Go to the documentation of this file.
00001 /****************************************************************
00002  *
00003  * Copyright (c) 2011
00004  * All rights reserved.
00005  *
00006  * Hochschule Bonn-Rhein-Sieg
00007  * University of Applied Sciences
00008  * Computer Science Department
00009  *
00010  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00011  *
00012  * Author:
00013  * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
00014  * Supervised by:
00015  * Gerhard K. Kraetzschmar
00016  *
00017  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00018  *
00019  * This sofware is published under a dual-license: GNU Lesser General Public
00020  * License LGPL 2.1 and BSD license. The dual-license implies that users of this
00021  * code may choose which terms they prefer.
00022  *
00023  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024  *
00025  * Redistribution and use in source and binary forms, with or without
00026  * modification, are permitted provided that the following conditions are met:
00027  *
00028  *     * Redistributions of source code must retain the above copyright
00029  *       notice, this list of conditions and the following disclaimer.
00030  *     * Redistributions in binary form must reproduce the above copyright
00031  *       notice, this list of conditions and the following disclaimer in the
00032  *       documentation and/or other materials provided with the distribution.
00033  *     * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
00034  *       contributors may be used to endorse or promote products derived from
00035  *       this software without specific prior written permission.
00036  *
00037  * This program is free software: you can redistribute it and/or modify
00038  * it under the terms of the GNU Lesser General Public License LGPL as
00039  * published by the Free Software Foundation, either version 2.1 of the
00040  * License, or (at your option) any later version or the BSD license.
00041  *
00042  * This program is distributed in the hope that it will be useful,
00043  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00044  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00045  * GNU Lesser General Public License LGPL and the BSD license for more details.
00046  *
00047  * You should have received a copy of the GNU Lesser General Public
00048  * License LGPL and BSD license along with this program.
00049  *
00050  ****************************************************************/
00051 
00052 #ifndef BRICS_OODL_LOGGER_HPP
00053 #define BRICS_OODL_LOGGER_HPP
00054 
00055 #include <iostream>
00056 #include <fstream>
00057 #include <ros/ros.h>
00058 
00059 #include "boost/date_time/posix_time/posix_time.hpp"
00060 
00061 
00062 namespace brics_oodl {
00063 
00064     enum severity_level {
00065         trace,
00066         debug,
00067         info,
00068         warning,
00069         error,
00070         fatal
00071     };
00072     
00076     class Logger {
00077     private:
00078         std::stringstream out;
00079         bool print;
00080         severity_level level;
00081     public:
00082 
00083         Logger(const std::string &funcName, const int &lineNo, const std::string &fileName, severity_level level);
00084         ~Logger();
00085         
00086         static bool toConsole;
00087         static bool toFile;
00088         static bool toROS;
00089         static severity_level logginLevel;
00090 
00091         template <class T>
00092         Logger & operator<<(const T &v) {
00093             out << v;
00094             return *this;
00095         }
00096     };
00097 
00098 
00099 #define LOG(level) Logger(__PRETTY_FUNCTION__, __LINE__ , __FILE__, level)
00100 
00101 
00102 } // namespace youbot
00103 
00104 #endif  /* YOUBOT_LOGGER_HPP */
00105 


cob_sick_s300
Author(s): Florian Weisshardt
autogenerated on Thu Aug 27 2015 12:45:42