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 <memory>
27 #include <iosfwd>
28 
29 namespace armarx::detail
30 {
31  enum class StreamPrinterTag
32  {
33  tag
34  };
35 
36  template<class Fnc>
38  {
39  StreamPrinter(Fnc&& f): fnc {std::move(f)} {}
40  Fnc fnc;
41  };
42 
43  template<class Fnc>
45  {
46  return StreamPrinter<Fnc> {std::move(f)};
47  }
48 }
49 
50 namespace armarx
51 {
52  template<class Fnc>
53  std::ostream& operator<<(std::ostream& o, const detail::StreamPrinter<Fnc>& f)
54  {
55  f.fnc(o);
56  return o;
57  }
58 
59 
60  class LogSender;
61  /**
62  * Typedef of std::shared_ptr for convenience.
63  */
64  using LogSenderPtr = std::shared_ptr<LogSender>;
65 
66  struct LogTag
67  {
68  LogTag();
69  LogTag(const std::string& tagName);
70  std::string tagName;
71  };
72 
73  struct SpamFilterData;
74  using SpamFilterDataPtr = std::shared_ptr<SpamFilterData>;
75 }
76 
armarx::detail::StreamPrinter::fnc
Fnc fnc
Definition: LoggingUtil.h:40
armarx::LogTag::LogTag
LogTag()
Definition: LoggingUtil.cpp:28
armarx::LogTag::tagName
std::string tagName
Definition: LoggingUtil.h:70
armarx::detail::StreamPrinterTag::tag
@ tag
armarx::detail::StreamPrinter
Definition: LoggingUtil.h:37
armarx::detail::operator*
StreamPrinter< Fnc > operator*(StreamPrinterTag, Fnc &&f)
Definition: LoggingUtil.h:44
armarx::SpamFilterDataPtr
std::shared_ptr< SpamFilterData > SpamFilterDataPtr
Definition: Logging.h:220
armarx::SpamFilterData
Definition: SpamFilterData.h:15
armarx::detail
Definition: ApplicationNetworkStats.cpp:34
armarx::detail::StreamPrinterTag
StreamPrinterTag
Definition: LoggingUtil.h:31
armarx::detail::StreamPrinter::StreamPrinter
StreamPrinter(Fnc &&f)
Definition: LoggingUtil.h:39
armarx::LogSenderPtr
std::shared_ptr< LogSender > LogSenderPtr
Typedef of std::shared_ptr for convenience.
Definition: Logging.h:217
armarx::operator<<
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
Definition: PythonApplicationManager.cpp:221
armarx::LogTag
Definition: LoggingUtil.h:66
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28