8#include "Arp/System/Core/event.hxx"
9#include "Arp/System/Core/TypeName.hxx"
10#include "Arp/System/Core/AppDomainSingleton.hxx"
11#include "Arp/System/Commons/Threading/Mutex.hpp"
12#include "Arp/System/Commons/Diagnostics/Logging/LogLevel.hpp"
13#include "Arp/System/Commons/Diagnostics/Logging/LogInfo.hpp"
14#include "Arp/System/Commons/Diagnostics/Logging/Internal/LogAdapter.hpp"
26namespace Arp {
namespace System {
namespace Commons {
namespace Diagnostics {
namespace Logging
32class LogEventAppender;
41 friend class Internal::LogAdapter;
47 using LogAdapter = Internal::LogAdapter;
48 using LogEventAppenderPtr = std::shared_ptr<Internal::LogEventAppender>;
50 using AppendDelegate = delegate<void(
const LogInfo&)>;
59 static void AssignAppDomain(
AppDomain& otherDomain);
60 static void Create(
const char* configFileName);
61 static void Create(
bool enableConsoleLogging,
const char* logFileName =
nullptr);
62 static void Create(LogLevel logLevel,
bool enableConsoleLogging,
const char* logFileName =
nullptr);
63 static void Create(
const char* layoutPattern,
bool enableConsoleLogging,
const char* logFileName =
nullptr);
64 static void Create(LogLevel logLevel,
const char* layoutPattern,
bool enableConsoleLogging,
const char* logFileName =
nullptr);
65 static void Dispose(
void);
68 void SetRootLevel(LogLevel value);
69 LogLevel GetRootLevel(
void);
70 Mutex& GetSyncRoot(
void);
73 LogAdapter CreateLogAdapter(
const char* loggerName);
74 void AddAppendDelegate(AppendDelegate appendDelegate);
75 void RemoveAppendDelegate(AppendDelegate appendDelegate);
78 void Initialize(LogLevel rootLevel, log4cplus::Logger& rootLogger);
79 log4cplus::Logger GetLoggerInstance(
const char* loggerName);
80 bool HasAppendEvent(
void);
81 void FireAppendEvent(
const LogInfo& logInfo);
85 LogAdapter::Ptr rootLogAdapterPtr;
86 log4cplus::Hierarchy* pRootHierarchy;
87 log4cplus::Initializer* pInitializer;
91 ARP_DEPRECATED(
"Do not use. Might still be referenced in obsolete inlined code.")
92 static std::atomic<size_t> appendEventCounter;
95 static const char*
const defaultLayoutPattern;
101inline void LogManager::SetRootLevel(LogLevel value)
103 this->rootLogAdapterPtr->SetLogLevel(value);
106inline LogLevel LogManager::GetRootLevel()
109 return this->rootLogAdapterPtr->logLevel;
114 return this->syncRoot;
117inline void LogManager::Create(
bool enableConsoleLogging,
const char* logFileName)
119 Create(LogLevel::Default,
nullptr, enableConsoleLogging, logFileName);
122inline void LogManager::Create(LogLevel logLevel,
bool enableConsoleLogging,
const char* logFileName)
124 Create(logLevel,
nullptr, enableConsoleLogging, logFileName);
127inline void LogManager::Create(
const char* layoutPattern,
bool enableConsoleLogging,
const char* logFileName)
129 Create(LogLevel::Default, layoutPattern, enableConsoleLogging, logFileName);
This class implements the singleton pattern for singletons with process wide scope.
Definition: AppDomainSingleton.hxx:25
This class represents a single application domain for each process and is implemented as singleton.
Definition: AppDomain.hpp:122
Definition: LogInfo.hpp:20
Definition: LogManager.hpp:39
Definition: LoggerBase.hxx:26
Mutual exclusion object to prevent data from concurrent modifications.
Definition: Mutex.hpp:26
Use this class to register and invoke several delegates (function pointer in OOP design).
Definition: event.hxx:33
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
The class implements an adapter for enums to define the string literals of the enum entries.
Definition: EnumStrings.hxx:38