From ae050524109f1ce827962665436ef7430f2ac479 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Wed, 22 Mar 2023 16:48:58 +0000 Subject: IVGCVSW-7255 Update Doxygen Documentation and publish on GitHub. * Updating Doxygen documentation for 23.02 release. Signed-off-by: David Monahan Change-Id: I545574ff7664b4595d2fe6a91a3c35d2ad55df82 --- 23.02/_logging_8cpp_source.xhtml | 271 ++++++++++++++++++++++++++++++++++----- 1 file changed, 237 insertions(+), 34 deletions(-) (limited to '23.02/_logging_8cpp_source.xhtml') diff --git a/23.02/_logging_8cpp_source.xhtml b/23.02/_logging_8cpp_source.xhtml index a992246427..b5b4de5fb1 100644 --- a/23.02/_logging_8cpp_source.xhtml +++ b/23.02/_logging_8cpp_source.xhtml @@ -8,7 +8,7 @@ - + ArmNN: src/armnn/Logging.cpp Source File @@ -19,9 +19,6 @@ - @@ -30,7 +27,8 @@ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); - + + @@ -51,18 +49,21 @@ - + +/* @license-end */
@@ -76,7 +77,9 @@ $(function() {
@@ -98,39 +101,239 @@ $(document).ready(function(){initNavTree('_logging_8cpp_source.xhtml','');});
Logging.cpp
-Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <armnn/Logging.hpp>
8 #include <armnn/Utils.hpp>
10 
11 #if defined(_MSC_VER)
12 #include <common/include/WindowsWrapper.hpp>
13 #endif
14 
15 #if defined(__ANDROID__)
16 #include <android/log.h>
17 #endif
18 
19 #include <iostream>
20 
21 namespace armnn
22 {
23 
24 template<LogSeverity Level>
26 {
27  static SimpleLogger<Level> logger;
28  return logger;
29 }
30 
31 template<>
33 {
35  return logger;
36 }
37 
38 template<>
40 {
42  return logger;
43 }
44 
45 template<>
47 {
48  static SimpleLogger<LogSeverity::Info> logger;
49  return logger;
50 }
51 
52 template<>
54 {
56  return logger;
57 }
58 
59 template<>
61 {
63  return logger;
64 }
65 
66 template<>
68 {
70  return logger;
71 }
72 
74 {
81  switch (level)
82  {
83  case LogSeverity::Trace:
86  case LogSeverity::Debug:
89  case LogSeverity::Info:
95  case LogSeverity::Error:
98  case LogSeverity::Fatal:
100  break;
101  default:
102  ARMNN_ASSERT(false);
103  }
104 }
105 
106 class StandardOutputColourSink : public LogSink
107 {
108 public:
109  StandardOutputColourSink(LogSeverity level = LogSeverity::Info)
110  : m_Level(level)
111  {
112  }
113 
114  void Consume(const std::string& s) override
115  {
116  std::cout << GetColour(m_Level) << s << ResetColour() << std::endl;
117  }
118 
119 private:
120  std::string ResetColour()
121  {
122  return "\033[0m";
123  }
124 
125  std::string GetColour(LogSeverity level)
126  {
127  switch(level)
128  {
129  case LogSeverity::Trace:
130  return "\033[35m";
131  case LogSeverity::Debug:
132  return "\033[32m";
133  case LogSeverity::Info:
134  return "\033[0m";
136  return "\033[33m";
137  case LogSeverity::Error:
138  return "\033[31m";
139  case LogSeverity::Fatal:
140  return "\033[41;30m";
141 
142  default:
143  return "\033[0m";
144  }
145  }
146  LogSeverity m_Level;
147 };
148 
149 class DebugOutputSink : public LogSink
150 {
151 public:
152  void Consume(const std::string& s) override
153  {
154  IgnoreUnused(s);
155 #if defined(_MSC_VER)
156  OutputDebugString(s.c_str());
157  OutputDebugString("\n");
158 #elif defined(__ANDROID__)
159  __android_log_write(ANDROID_LOG_DEBUG, "armnn", s.c_str());
160 #else
161  IgnoreUnused(s);
162 #endif
163  }
164 };
165 
166 template<LogSeverity Level>
167 inline void SetLoggingSinks(bool standardOut, bool debugOut, bool coloured)
168 {
170 
171  if (standardOut)
172  {
173  if (coloured)
174  {
176  std::make_shared<StandardOutputColourSink>(Level));
177  } else
178  {
180  std::make_shared<StandardOutputSink>());
181  }
182  }
183 
184  if (debugOut)
185  {
187  std::make_shared<DebugOutputSink>());
188  }
189 }
190 
191 void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
192 {
193  SetLoggingSinks<LogSeverity::Trace>(standardOut, debugOut, coloured);
194  SetLoggingSinks<LogSeverity::Debug>(standardOut, debugOut, coloured);
195  SetLoggingSinks<LogSeverity::Info>(standardOut, debugOut, coloured);
196  SetLoggingSinks<LogSeverity::Warning>(standardOut, debugOut, coloured);
197  SetLoggingSinks<LogSeverity::Error>(standardOut, debugOut, coloured);
198  SetLoggingSinks<LogSeverity::Fatal>(standardOut, debugOut, coloured);
199 }
200 
201 } //namespace armnn
- -
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
Definition: Logging.cpp:191
- -
void Enable(bool enable=true)
Definition: Logging.hpp:168
- - -
static SimpleLogger & Get()
Definition: Logging.cpp:25
-
Copyright (c) 2021 ARM Limited and Contributors.
-
void IgnoreUnused(Ts &&...)
- - -
void SetLogFilter(LogSeverity level)
Definition: Logging.cpp:73
-
#define ARMNN_FALLTHROUGH
Definition: Utils.hpp:35
-
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
- - - - -
void AddSink(std::shared_ptr< LogSink > sink)
Definition: Logging.hpp:183
-
LogSeverity
Definition: Utils.hpp:12
- -
void SetLoggingSinks(bool standardOut, bool debugOut, bool coloured)
Definition: Logging.cpp:167
- +Go to the documentation of this file.
1 //
+
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+
6 #include <armnn/Logging.hpp>
+ +
8 #include <armnn/Utils.hpp>
+ +
10 
+
11 #if defined(_MSC_VER)
+
12 #include <common/include/WindowsWrapper.hpp>
+
13 #endif
+
14 
+
15 #if defined(__ANDROID__)
+
16 #include <android/log.h>
+
17 #endif
+
18 
+
19 #include <iostream>
+
20 
+
21 namespace armnn
+
22 {
+
23 
+
24 template<LogSeverity Level>
+ +
26 {
+
27  static SimpleLogger<Level> logger;
+
28  return logger;
+
29 }
+
30 
+
31 template<>
+ +
33 {
+ +
35  return logger;
+
36 }
+
37 
+
38 template<>
+ +
40 {
+ +
42  return logger;
+
43 }
+
44 
+
45 template<>
+ +
47 {
+
48  static SimpleLogger<LogSeverity::Info> logger;
+
49  return logger;
+
50 }
+
51 
+
52 template<>
+ +
54 {
+ +
56  return logger;
+
57 }
+
58 
+
59 template<>
+ +
61 {
+ +
63  return logger;
+
64 }
+
65 
+
66 template<>
+ +
68 {
+ +
70  return logger;
+
71 }
+
72 
+ +
74 {
+ + + + + + +
81  switch (level)
+
82  {
+
83  case LogSeverity::Trace:
+ + +
86  case LogSeverity::Debug:
+ + +
89  case LogSeverity::Info:
+ + + + + +
95  case LogSeverity::Error:
+ + +
98  case LogSeverity::Fatal:
+ +
100  break;
+
101  default:
+
102  ARMNN_ASSERT(false);
+
103  }
+
104 }
+
105 
+
106 class StandardOutputColourSink : public LogSink
+
107 {
+
108 public:
+
109  StandardOutputColourSink(LogSeverity level = LogSeverity::Info)
+
110  : m_Level(level)
+
111  {
+
112  }
+
113 
+
114  void Consume(const std::string& s) override
+
115  {
+
116  std::cout << GetColour(m_Level) << s << ResetColour() << std::endl;
+
117  }
+
118 
+
119 private:
+
120  std::string ResetColour()
+
121  {
+
122  return "\033[0m";
+
123  }
+
124 
+
125  std::string GetColour(LogSeverity level)
+
126  {
+
127  switch(level)
+
128  {
+
129  case LogSeverity::Trace:
+
130  return "\033[35m";
+
131  case LogSeverity::Debug:
+
132  return "\033[32m";
+
133  case LogSeverity::Info:
+
134  return "\033[0m";
+ +
136  return "\033[33m";
+
137  case LogSeverity::Error:
+
138  return "\033[31m";
+
139  case LogSeverity::Fatal:
+
140  return "\033[41;30m";
+
141 
+
142  default:
+
143  return "\033[0m";
+
144  }
+
145  }
+
146  LogSeverity m_Level;
+
147 };
+
148 
+
149 class DebugOutputSink : public LogSink
+
150 {
+
151 public:
+
152  void Consume(const std::string& s) override
+
153  {
+
154  IgnoreUnused(s);
+
155 #if defined(_MSC_VER)
+
156  OutputDebugString(s.c_str());
+
157  OutputDebugString("\n");
+
158 #elif defined(__ANDROID__)
+
159  __android_log_write(ANDROID_LOG_DEBUG, "armnn", s.c_str());
+
160 #else
+
161  IgnoreUnused(s);
+
162 #endif
+
163  }
+
164 };
+
165 
+
166 template<LogSeverity Level>
+
167 inline void SetLoggingSinks(bool standardOut, bool debugOut, bool coloured)
+
168 {
+ +
170 
+
171  if (standardOut)
+
172  {
+
173  if (coloured)
+
174  {
+ +
176  std::make_shared<StandardOutputColourSink>(Level));
+
177  } else
+
178  {
+ +
180  std::make_shared<StandardOutputSink>());
+
181  }
+
182  }
+
183 
+
184  if (debugOut)
+
185  {
+ +
187  std::make_shared<DebugOutputSink>());
+
188  }
+
189 }
+
190 
+
191 void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
+
192 {
+
193  SetLoggingSinks<LogSeverity::Trace>(standardOut, debugOut, coloured);
+
194  SetLoggingSinks<LogSeverity::Debug>(standardOut, debugOut, coloured);
+
195  SetLoggingSinks<LogSeverity::Info>(standardOut, debugOut, coloured);
+
196  SetLoggingSinks<LogSeverity::Warning>(standardOut, debugOut, coloured);
+
197  SetLoggingSinks<LogSeverity::Error>(standardOut, debugOut, coloured);
+
198  SetLoggingSinks<LogSeverity::Fatal>(standardOut, debugOut, coloured);
+
199 }
+
200 
+
201 } //namespace armnn
+
void SetLogFilter(LogSeverity level)
Definition: Logging.cpp:73
+
void SetLoggingSinks(bool standardOut, bool debugOut, bool coloured)
Definition: Logging.cpp:167
+ +
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
Definition: Logging.cpp:191
+
void Enable(bool enable=true)
Definition: Logging.hpp:168
+
LogSeverity
Definition: Utils.hpp:12
+ +
#define ARMNN_FALLTHROUGH
Definition: Utils.hpp:35
+ +
void IgnoreUnused(Ts &&...)
+ +
static SimpleLogger & Get()
Definition: Logging.cpp:25
+ +
Copyright (c) 2021 ARM Limited and Contributors.
+ + + +
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+ + +
void AddSink(std::shared_ptr< LogSink > sink)
Definition: Logging.hpp:183
+ + -- cgit v1.2.1