2 * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
19 * @file src/common/log/log.cpp
20 * @author Adam Malinowski <a.malinowsk2@partner.samsung.com>
22 * @brief Simple file containing definition of logging level variable.
30 #ifndef CYNARA_NO_LOGS
31 #ifdef BUILD_TYPE_DEBUG
32 int __log_level = LOG_DEBUG;
34 int __log_level = LOG_ERR;
37 static int strlog2intlog(const char *strlog) {
38 if(!strncmp("LOG_EMERG", strlog, strlen("LOG_EMERG")))
40 if(!strncmp("LOG_ALERT", strlog, strlen("LOG_ALERT")))
42 if(!strncmp("LOG_CRIT", strlog, strlen("LOG_CRIT")))
44 if(!strncmp("LOG_ERR", strlog, strlen("LOG_ERR")))
46 if(!strncmp("LOG_WARNING", strlog, strlen("LOG_WARNING")))
48 if(!strncmp("LOG_NOTICE", strlog, strlen("LOG_NOTICE")))
50 if(!strncmp("LOG_INFO", strlog, strlen("LOG_INFO")))
52 if(!strncmp("LOG_DEBUG", strlog, strlen("LOG_DEBUG")))
59 char *env_val = getenv("CYNARA_LOG_LEVEL");
61 __log_level = strlog2intlog(env_val);
67 void init_log(void) {}
69 #endif //CYNARA_NO_LOGS