2626 * For further information see http://www.genivi.org/.
2727 ******************************************************************************/
2828
29- #ifndef CAMDLTLOGGING_H_
30- #define CAMDLTLOGGING_H_
29+ #ifndef CAMRAALSALOGGING_H_
30+ #define CAMRAALSALOGGING_H_
3131
32- #include " CAmDltWrapper .h"
32+ #include " CAmLogWrapper .h"
3333
34- #define CONTEXT " AMRA"
3534
3635namespace am
3736{
3837
3938/* *
40- * \brief DLT logging on AMRA Context
39+ * \brief Short-hand notations for a logging context dedicated to the ALSA Routing-Adapter
4140 *
42- * This class is a Singleton which allows Plugin Routing Adapter ALSA to DLT log towards its own Context
41+ * This class is implemented as Singleton
4342 */
44- class CAmDLTLogging
43+ class CAmRaAlsaLogging
4544{
4645public:
4746 /* *
4847 * Allows to retrieve the Singleton
4948 */
50- static CAmDLTLogging *Instance ();
49+ static CAmRaAlsaLogging *Instance ();
5150 /* *
5251 * dtor
5352 */
54- virtual ~CAmDLTLogging ();
53+ virtual ~CAmRaAlsaLogging ();
54+
5555 /* *
56- * returns a pointer to the DltContext. Such Context is then used when implementing
57- * the variadic template logging functions used throughout the plugin
56+ * provide access to logging context
5857 */
59- DltContext *getContextPointer ();
58+ inline static IAmLogContext &getContext ()
59+ {
60+ return Instance ()->mContext ;
61+ }
6062
6163private:
6264 /* *
6365 * private ctor being a singleton
6466 */
65- CAmDLTLogging ();
66-
67- private:
68- DltContext mContext ;
69- static CAmDLTLogging *mCAmDLTLogging ;
67+ CAmRaAlsaLogging ();
7068
69+ IAmLogContext &mContext ;
70+ static CAmRaAlsaLogging *mpLogging;
7171};
7272
7373/* *
@@ -78,12 +78,7 @@ class CAmDLTLogging
7878template <typename T, typename ... TArgs>
7979void logAmRaDebug (T value, TArgs... args)
8080{
81- CAmDltWrapper* inst (CAmDltWrapper::instance ());
82- if (!inst->init (DLT_LOG_DEBUG , CAmDLTLogging::Instance ()->getContextPointer ()))
83- return ;
84- inst->append (value);
85- inst->append (args...);
86- inst->send ();
81+ CAmRaAlsaLogging::getContext ().debug (value, args...);
8782}
8883
8984/* *
@@ -94,12 +89,7 @@ void logAmRaDebug(T value, TArgs... args)
9489template <typename T, typename ... TArgs>
9590void logAmRaInfo (T value, TArgs... args)
9691{
97- CAmDltWrapper* inst (CAmDltWrapper::instance ());
98- if (!inst->init (DLT_LOG_INFO , CAmDLTLogging::Instance ()->getContextPointer ()))
99- return ;
100- inst->append (value);
101- inst->append (args...);
102- inst->send ();
92+ CAmRaAlsaLogging::getContext ().info (value, args...);
10393}
10494
10595/* *
@@ -110,14 +100,8 @@ void logAmRaInfo(T value, TArgs... args)
110100template <typename T, typename ... TArgs>
111101void logAmRaError (T value, TArgs... args)
112102{
113- CAmDltWrapper* inst (CAmDltWrapper::instance ());
114-
115- if (!inst->init (DLT_LOG_ERROR , CAmDLTLogging::Instance ()->getContextPointer ()))
116- return ;
117- inst->append (value);
118- inst->append (args...);
119- inst->send ();
103+ CAmRaAlsaLogging::getContext ().error (value, args...);
120104}
121105
122106} /* namespace am */
123- #endif /* CAMDLTLOGGING_H_ */
107+ #endif /* CAMRAALSALOGGING_H_ */
0 commit comments