8 #include "Arp/System/Commons/Text/Formatter.hxx"
9 #include "Arp/System/Commons/Diagnostics/Logging/LogStream.hpp"
10 #include "Arp/System/Commons/Diagnostics/Logging/Internal/LogAdapter.hpp"
12 namespace Arp {
namespace System {
namespace Commons {
namespace Diagnostics {
namespace Logging
26 template<
typename... Args>
static void Trace(
const char* format,
const Args& ... args);
27 template<
typename... Args>
static void Debug(
const char* format,
const Args& ... args);
28 template<
typename... Args>
static void Info(
const char* format,
const Args& ... args);
29 template<
typename... Args>
static void Warning(
const char* format,
const Args& ... args);
30 template<
typename... Args>
static void Critical(
const char* format,
const Args& ... args);
31 template<
typename... Args>
static void Error(
const char* format,
const Args& ... args);
32 template<
typename... Args>
static void Fatal(
const char* format,
const Args& ... args);
34 template<
typename... Args>
static void PrintTrace(
const char* format,
const Args& ... args);
35 template<
typename... Args>
static void PrintDebug(
const char* format,
const Args& ... args);
36 template<
typename... Args>
static void PrintInfo(
const char* format,
const Args& ... args);
37 template<
typename... Args>
static void PrintWarning(
const char* format,
const Args& ... args);
38 template<
typename... Args>
static void PrintCritical(
const char* format,
const Args& ... args);
39 template<
typename... Args>
static void PrintError(
const char* format,
const Args& ... args);
40 template<
typename... Args>
static void PrintFatal(
const char* format,
const Args& ... args);
52 static void Initialize(LogAdapter::Ptr rootLogAdapter);
53 static void Uninitialize(
void);
56 static LogAdapter::Ptr rootLogAdapterPtr;
61 inline void Log::Initialize(LogAdapter::Ptr rootLogAdapter)
63 rootLogAdapterPtr = rootLogAdapter;
66 inline void Log::Uninitialize()
68 rootLogAdapterPtr.reset();
71 template<
typename... Args>
72 inline void Log::Trace(
const char* format,
const Args& ... args)
74 if (rootLogAdapterPtr !=
nullptr)
76 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Trace)
85 template<
typename... Args>
86 inline void Log::Debug(
const char* format,
const Args& ... args)
88 if (rootLogAdapterPtr !=
nullptr)
90 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Debug)
99 template<
typename... Args>
100 inline void Log::Info(
const char* format,
const Args& ... args)
102 if (rootLogAdapterPtr !=
nullptr)
104 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Info)
113 template<
typename... Args>
114 inline void Log::Warning(
const char* format,
const Args& ... args)
116 if (rootLogAdapterPtr !=
nullptr)
118 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Warning)
127 template<
typename... Args>
128 inline void Log::Critical(
const char* format,
const Args& ... args)
130 if (rootLogAdapterPtr !=
nullptr)
132 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Critical)
141 template<
typename... Args>
142 inline void Log::Error(
const char* format,
const Args& ... args)
144 if (rootLogAdapterPtr !=
nullptr)
146 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Error)
155 template<
typename... Args>
156 inline void Log::Fatal(
const char* format,
const Args& ... args)
158 if (rootLogAdapterPtr !=
nullptr)
160 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Fatal)
169 template<
typename... Args>
170 inline void Log::PrintTrace(
const char* format,
const Args& ... args)
172 if (rootLogAdapterPtr !=
nullptr)
174 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Trace)
183 template<
typename... Args>
184 inline void Log::PrintDebug(
const char* format,
const Args& ... args)
186 if (rootLogAdapterPtr !=
nullptr)
188 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Debug)
197 template<
typename... Args>
198 inline void Log::PrintInfo(
const char* format,
const Args& ... args)
200 if (rootLogAdapterPtr !=
nullptr)
202 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Info)
211 template<
typename... Args>
212 inline void Log::PrintWarning(
const char* format,
const Args& ... args)
214 if (rootLogAdapterPtr !=
nullptr)
216 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Warning)
225 template<
typename... Args>
226 inline void Log::PrintCritical(
const char* format,
const Args& ... args)
228 if (rootLogAdapterPtr !=
nullptr)
230 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Critical)
239 template<
typename... Args>
240 inline void Log::PrintError(
const char* format,
const Args& ... args)
242 if (rootLogAdapterPtr !=
nullptr)
244 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Error)
253 template<
typename... Args>
254 inline void Log::PrintFatal(
const char* format,
const Args& ... args)
256 if (rootLogAdapterPtr !=
nullptr)
258 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Fatal)
267 inline LogStream Log::Trace()
269 if (rootLogAdapterPtr !=
nullptr)
271 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Trace) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Trace);
275 return LogStream::Null;
279 inline LogStream Log::Debug()
281 if (rootLogAdapterPtr !=
nullptr)
283 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Debug) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Debug);
287 return LogStream::Null;
291 inline LogStream Log::Info()
293 if (rootLogAdapterPtr !=
nullptr)
295 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Info) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Info);
299 return LogStream::Null;
303 inline LogStream Log::Warning()
305 if (rootLogAdapterPtr !=
nullptr)
307 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Warning) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Warning);
311 return LogStream::Null;
315 inline LogStream Log::Critical()
317 if (rootLogAdapterPtr !=
nullptr)
319 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Critical) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Critical);
323 return LogStream::Null;
327 inline LogStream Log::Error()
329 if (rootLogAdapterPtr !=
nullptr)
331 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Error) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Error);
335 return LogStream::Null;
339 inline LogStream Log::Fatal()
341 if (rootLogAdapterPtr !=
nullptr)
343 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Fatal) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Fatal);
347 return LogStream::Null;
Definition: LogManager.hpp:39
Definition: LogStream.hpp:23
static String FormatPrintf(const String &format, const Args &... args)
Uses Ansi-C printf syntax for the placeholders in the format string like 's'.
Definition: Formatter.hxx:53
static String FormatCommon(const String &format, const Args &... args)
Uses common CLR syntax (.Net) for the placeholders in the format string like '{0}'.
Definition: Formatter.hxx:39
@ System
System components used by the System, Device, Plc or Io domains.
Namespace for classes handling text
Definition: Formatter.hxx:11
Root namespace for the PLCnext API