PLCnext API Documentation 26.0.1.58
LogManager.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/delegate.hxx"
9#include "Arp/System/Commons/Diagnostics/Logging/LogEvent.hpp"
10#include "Arp/System/Commons/Diagnostics/Logging/LogSettings.hpp"
11
12namespace Arp { namespace System { namespace Commons { namespace Diagnostics { namespace Logging
13{
14
18class ARP_CXX_SYMBOL_EXPORT LogManager
19{
20public: // Impl forward declaration
21 class Impl;
22 friend class Impl;
23
24public: // usings
25 using Instance = LogManager;
26 using LogEventDelegate = delegate<void(const LogEvent&)>;
27
28public: // construction/copy/move/assign/destruction
29 LogManager(void);
30 explicit LogManager(const LogSettings& logSettings);
31 LogManager(const LogManager& arg) = delete;
32 LogManager(LogManager&& arg)noexcept = delete;
33 LogManager& operator=(const LogManager& arg) = delete;
34 LogManager& operator=(LogManager&& arg)noexcept = delete;
36
37public: // static singleton operations
38 static void CreateInstance(LogLevel logLevel = LogLevel::Debug);
39 static void CreateInstance(const LogSettings& logSettings);
40 static bool IsCreated(void);
41 static void DisposeInstance(void);
42 static Instance& GetInstance(void);
43
44public: // setter/getter operations
45 void SetRootLevel(LogLevel value);
46 LogLevel GetRootLevel(void)const;
47
48public: // operations
49 void AddLogEventDelegate(LogEventDelegate delegator);
50 void RemoveLogEventDelegate(LogEventDelegate delegator);
51
52public: // internal operations
53 Impl& GetImpl(void);
54 const Impl& GetImpl(void)const;
55
56private: // Impl usings
57 using Pimpl = PimplPtr<Impl>;
58
59private: // Impl fields
60 Pimpl pimpl;
61};
62
63}}}}} // end of namespace Arp::System::Commons::Diagnostics::Logging
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
Prototyping of delegate template.
Definition: delegate.hxx:14
This class is used to forward log events from LogEngine.
Definition: LogEvent.hpp:24
This singleton class is used to initialize and configure the Arp logging.
Definition: LogManager.hpp:19
This class is used to compound all log settings of the application for initializing the log engine.
Definition: LogSettings.hpp:25
Root namespace for the PLCnext API