1 // Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 
6 #ifndef VSOMEIP_V3_LOGGER_CONFIGURATION_HPP_
7 #define VSOMEIP_V3_LOGGER_CONFIGURATION_HPP_
8 
9 #include <memory>
10 #include <mutex>
11 
12 #ifdef USE_DLT
13 #include <dlt/dlt.h>
14 #endif
15 
16 #include <vsomeip/internal/logger.hpp>
17 
18 namespace vsomeip_v3 {
19 
20 class configuration;
21 
22 namespace logger {
23 
24 class logger_impl {
25 public:
26     VSOMEIP_IMPORT_EXPORT static void init(const std::shared_ptr<configuration> &_configuration);
27     static std::shared_ptr<logger_impl> get();
28 
29     logger_impl() = default;
30     ~logger_impl();
31 
32     std::shared_ptr<configuration> get_configuration() const;
33 
34 #ifdef USE_DLT
35     void log(level_e _level, const char *_data);
36 
37 private:
38     void enable_dlt(const std::string &_application, const std::string &_context);
39 #endif
40 
41 private:
42     static std::mutex mutex__;
43     std::shared_ptr<configuration> configuration_;
44 
45 #ifdef USE_DLT
46     DLT_DECLARE_CONTEXT(dlt_);
47 #endif
48 };
49 
50 } // namespace logger
51 } // namespace vsomeip_v3
52 
53 #endif // VSOMEIP_V3_LOGGER_CONFIGURATION_HPP_
54