Refactor dcm-client code
[platform/core/security/device-certificate-manager.git] / src / dcm-daemon / logging.h
1 /******************************************************************
2  *
3  * Copyright 2017 - 2020 Samsung Electronics All Rights Reserved.
4  *
5  * Author: Jaroslaw Pelczar <j.pelczar@samsung.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 #ifndef DCM_DAEMON_LOGGING_H_
22 #define DCM_DAEMON_LOGGING_H_
23
24 #include <boost/log/common.hpp>
25 #include <boost/log/expressions.hpp>
26 #include <boost/log/attributes.hpp>
27 #include <boost/log/sinks/sync_frontend.hpp>
28 #include <boost/log/sinks/syslog_backend.hpp>
29 #include <boost/log/sources/logger.hpp>
30 #include <boost/log/utility/setup/console.hpp>
31 #include <boost/log/utility/setup/common_attributes.hpp>
32 #include <boost/log/attributes/timer.hpp>
33 #include <boost/log/attributes/named_scope.hpp>
34
35 #define LOG_TAG         "DCM_SERVER"
36 #include <dlog.h>
37
38 enum class log_severity {
39         debug,
40         normal,
41         warning,
42         error
43 };
44
45 // Global logger declaration
46 BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(dcm_logger, boost::log::sources::severity_logger_mt<log_severity>)
47
48 #if defined(NDEBUG) && !defined(DEBUG)
49 #else
50 #define ENABLE_DEBUG_LOGGING            1
51 #endif
52
53 #endif /* DCM_DAEMON_LOGGING_H_ */