Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
youbot_driver
generic
Logger.hpp
Go to the documentation of this file.
1
/****************************************************************
2
*
3
* Copyright (c) 2011
4
* All rights reserved.
5
*
6
* Hochschule Bonn-Rhein-Sieg
7
* University of Applied Sciences
8
* Computer Science Department
9
*
10
* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11
*
12
* Author:
13
* Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
14
* Supervised by:
15
* Gerhard K. Kraetzschmar
16
*
17
* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18
*
19
* This sofware is published under a dual-license: GNU Lesser General Public
20
* License LGPL 2.1 and BSD license. The dual-license implies that users of this
21
* code may choose which terms they prefer.
22
*
23
* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24
*
25
* Redistribution and use in source and binary forms, with or without
26
* modification, are permitted provided that the following conditions are met:
27
*
28
* * Redistributions of source code must retain the above copyright
29
* notice, this list of conditions and the following disclaimer.
30
* * Redistributions in binary form must reproduce the above copyright
31
* notice, this list of conditions and the following disclaimer in the
32
* documentation and/or other materials provided with the distribution.
33
* * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
34
* contributors may be used to endorse or promote products derived from
35
* this software without specific prior written permission.
36
*
37
* This program is free software: you can redistribute it and/or modify
38
* it under the terms of the GNU Lesser General Public License LGPL as
39
* published by the Free Software Foundation, either version 2.1 of the
40
* License, or (at your option) any later version or the BSD license.
41
*
42
* This program is distributed in the hope that it will be useful,
43
* but WITHOUT ANY WARRANTY; without even the implied warranty of
44
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45
* GNU Lesser General Public License LGPL and the BSD license for more details.
46
*
47
* You should have received a copy of the GNU Lesser General Public
48
* License LGPL and BSD license along with this program.
49
*
50
****************************************************************/
51
52
#ifndef YOUBOT_LOGGER_HPP
53
#define YOUBOT_LOGGER_HPP
54
55
#include <iostream>
56
#include <fstream>
57
#include "boost/date_time/posix_time/posix_time.hpp"
58
59
#ifdef USE_ROS_LOGGING
60
#include <
ros/ros.h
>
61
#endif
62
63
namespace
youbot
{
64
65
enum
severity_level
{
66
trace
,
67
debug
,
68
info
,
69
warning
,
70
error
,
71
fatal
72
};
73
77
class
Logger
{
78
private
:
79
std::stringstream
out
;
80
bool
print
;
81
severity_level
level
;
82
public
:
83
84
Logger
(
const
std::string &funcName,
const
int
&lineNo,
const
std::string &fileName,
severity_level
level);
85
~Logger
();
86
87
static
bool
toConsole
;
88
static
bool
toFile
;
89
static
bool
toROS
;
90
static
severity_level
logginLevel
;
91
92
template
<
class
T>
93
Logger
&
operator<<
(
const
T &v) {
94
out << v;
95
return
*
this
;
96
}
97
};
98
99
#ifdef _MSC_VER
100
#define LOG(level) Logger(__FUNCTION__, __LINE__ , __FILE__, level)
101
#else
102
#define LOG(level) Logger(__PRETTY_FUNCTION__, __LINE__ , __FILE__, level)
103
#endif
104
105
}
// namespace youbot
106
107
#endif
/* YOUBOT_LOGGER_HPP */
108
youbot::severity_level
severity_level
Definition:
Logger.hpp:65
youbot::error
Definition:
Logger.hpp:70
youbot
Definition:
FourSwedishWheelOmniBaseKinematic.hpp:60
youbot::Logger::toROS
static bool toROS
Definition:
Logger.hpp:89
youbot::Logger::~Logger
~Logger()
Definition:
Logger.cpp:108
youbot::Logger::logginLevel
static severity_level logginLevel
Definition:
Logger.hpp:90
youbot::Logger::Logger
Logger(const std::string &funcName, const int &lineNo, const std::string &fileName, severity_level level)
Definition:
Logger.cpp:61
youbot::Logger::out
std::stringstream out
Definition:
Logger.hpp:79
youbot::Logger::toConsole
static bool toConsole
Definition:
Logger.hpp:87
youbot::Logger::toFile
static bool toFile
Definition:
Logger.hpp:88
youbot::Logger::print
bool print
Definition:
Logger.hpp:80
ros.h
youbot::warning
Definition:
Logger.hpp:69
youbot::debug
Definition:
Logger.hpp:67
youbot::fatal
Definition:
Logger.hpp:71
youbot::Logger
Implementation logging to console and to a file.
Definition:
Logger.hpp:77
youbot::trace
Definition:
Logger.hpp:66
youbot::info
Definition:
Logger.hpp:68
youbot::Logger::operator<<
Logger & operator<<(const T &v)
Definition:
Logger.hpp:93
youbot::Logger::level
severity_level level
Definition:
Logger.hpp:81
youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Jun 10 2019 15:46:24