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"
12namespace 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;
61inline void Log::Initialize(LogAdapter::Ptr rootLogAdapter)
63 rootLogAdapterPtr = rootLogAdapter;
66inline void Log::Uninitialize()
68 rootLogAdapterPtr.reset();
71template<
typename... Args>
72inline void Log::Trace(
const char* format,
const Args& ... args)
74 if (rootLogAdapterPtr !=
nullptr)
76 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Trace)
85template<
typename... Args>
86inline void Log::Debug(
const char* format,
const Args& ... args)
88 if (rootLogAdapterPtr !=
nullptr)
90 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Debug)
99template<
typename... Args>
100inline void Log::Info(
const char* format,
const Args& ... args)
102 if (rootLogAdapterPtr !=
nullptr)
104 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Info)
113template<
typename... Args>
114inline void Log::Warning(
const char* format,
const Args& ... args)
116 if (rootLogAdapterPtr !=
nullptr)
118 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Warning)
127template<
typename... Args>
128inline void Log::Critical(
const char* format,
const Args& ... args)
130 if (rootLogAdapterPtr !=
nullptr)
132 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Critical)
141template<
typename... Args>
142inline void Log::Error(
const char* format,
const Args& ... args)
144 if (rootLogAdapterPtr !=
nullptr)
146 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Error)
155template<
typename... Args>
156inline void Log::Fatal(
const char* format,
const Args& ... args)
158 if (rootLogAdapterPtr !=
nullptr)
160 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Fatal)
169template<
typename... Args>
170inline void Log::PrintTrace(
const char* format,
const Args& ... args)
172 if (rootLogAdapterPtr !=
nullptr)
174 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Trace)
183template<
typename... Args>
184inline void Log::PrintDebug(
const char* format,
const Args& ... args)
186 if (rootLogAdapterPtr !=
nullptr)
188 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Debug)
197template<
typename... Args>
198inline void Log::PrintInfo(
const char* format,
const Args& ... args)
200 if (rootLogAdapterPtr !=
nullptr)
202 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Info)
211template<
typename... Args>
212inline void Log::PrintWarning(
const char* format,
const Args& ... args)
214 if (rootLogAdapterPtr !=
nullptr)
216 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Warning)
225template<
typename... Args>
226inline void Log::PrintCritical(
const char* format,
const Args& ... args)
228 if (rootLogAdapterPtr !=
nullptr)
230 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Critical)
239template<
typename... Args>
240inline void Log::PrintError(
const char* format,
const Args& ... args)
242 if (rootLogAdapterPtr !=
nullptr)
244 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Error)
253template<
typename... Args>
254inline void Log::PrintFatal(
const char* format,
const Args& ... args)
256 if (rootLogAdapterPtr !=
nullptr)
258 if (rootLogAdapterPtr->GetLogLevel() < LogLevel::Fatal)
269 if (rootLogAdapterPtr !=
nullptr)
271 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Trace) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Trace);
275 return LogStream::Null;
281 if (rootLogAdapterPtr !=
nullptr)
283 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Debug) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Debug);
287 return LogStream::Null;
293 if (rootLogAdapterPtr !=
nullptr)
295 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Info) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Info);
299 return LogStream::Null;
305 if (rootLogAdapterPtr !=
nullptr)
307 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Warning) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Warning);
311 return LogStream::Null;
317 if (rootLogAdapterPtr !=
nullptr)
319 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Critical) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Critical);
323 return LogStream::Null;
329 if (rootLogAdapterPtr !=
nullptr)
331 return (rootLogAdapterPtr->GetLogLevel() < LogLevel::Error) ? LogStream::Null : rootLogAdapterPtr->GetLogStream(LogLevel::Error);
335 return LogStream::Null;
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