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 #ifdef BUILD_TYPE_DEBUG
31 int __log_level = LOG_DEBUG;
33 int __log_level = LOG_ERR;
36 static int strlog2intlog(const char *strlog) {
37 if(!strncmp("LOG_EMERG", strlog, strlen("LOG_EMERG")))
39 if(!strncmp("LOG_ALERT", strlog, strlen("LOG_ALERT")))
41 if(!strncmp("LOG_CRIT", strlog, strlen("LOG_CRIT")))
43 if(!strncmp("LOG_ERR", strlog, strlen("LOG_ERR")))
45 if(!strncmp("LOG_WARNING", strlog, strlen("LOG_WARNING")))
47 if(!strncmp("LOG_NOTICE", strlog, strlen("LOG_NOTICE")))
49 if(!strncmp("LOG_INFO", strlog, strlen("LOG_INFO")))
51 if(!strncmp("LOG_DEBUG", strlog, strlen("LOG_DEBUG")))
58 char *env_val = getenv("CYNARA_LOG_LEVEL");
60 __log_level = strlog2intlog(env_val);