LoggingUtil.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5*
6* ArmarX is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License version 2 as
8* published by the Free Software Foundation.
9*
10* ArmarX is distributed in the hope that it will be useful, but
11* WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17*
18* @package ArmarXCore::core
19* @author Mirko Waechter (mirko dot waechter at kit dot edu)
20* @date 2017
21* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22* GNU General Public License
23*/
24#pragma once
25
26#include <iosfwd>
27#include <memory>
28
29namespace armarx::detail
30{
32 {
34 };
35
36 template <class Fnc>
38 {
39 StreamPrinter(Fnc&& f) : fnc{std::move(f)}
40 {
41 }
42
43 Fnc fnc;
44 };
45
46 template <class Fnc>
49 {
50 return StreamPrinter<Fnc>{std::move(f)};
51 }
52} // namespace armarx::detail
53
54namespace armarx
55{
56 template <class Fnc>
57 std::ostream&
58 operator<<(std::ostream& o, const detail::StreamPrinter<Fnc>& f)
59 {
60 f.fnc(o);
61 return o;
62 }
63
64
65 class LogSender;
66 /**
67 * Typedef of std::shared_ptr for convenience.
68 */
69 using LogSenderPtr = std::shared_ptr<LogSender>;
70
71 struct LogTag
72 {
73 LogTag();
74 LogTag(const std::string& tagName);
75 std::string tagName;
76 };
77
78 struct SpamFilterData;
79 using SpamFilterDataPtr = std::shared_ptr<SpamFilterData>;
80} // namespace armarx
StreamPrinter< Fnc > operator*(StreamPrinterTag, Fnc &&f)
Definition LoggingUtil.h:48
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
std::shared_ptr< SpamFilterData > SpamFilterDataPtr
Definition Logging.h:227
std::shared_ptr< LogSender > LogSenderPtr
Typedef of std::shared_ptr for convenience.
Definition Logging.h:224
std::string tagName
Definition LoggingUtil.h:75