2 * Copyright (c) 2018-2020, Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "libdlog_base_wrap.c"
21 log_config_set(&CONFIG, "backend", "pipe");
22 log_config_set(&CONFIG, "limiter", "0");
24 assert(dlog_print(DLOG_ERROR, "tag", "msg") == 0xDECC16);
25 assert(!dynamic_config_called);
26 assert(write_to_log == wtl_pipe);
27 assert(!limiter_created);
30 log_config_set(&CONFIG, "backend", "logger");
31 log_config_set(&CONFIG, "limiter", "1");
32 log_config_set(&CONFIG, "debugmode", "0");
33 use_dynamic_conf = true;
34 limiter_ret = (struct pass_log_result) { .decision = DECISION_ALLOWED };
36 assert(dlog_print(DLOG_ERROR, "tag", "msg") == 45835705);
37 assert(__dlog_print(LOG_ID_MAIN, DLOG_ERROR, "tag", "msg") == 45835705);
38 assert(write_to_log != wtl_pipe); // ceci n'est pas une pipe
39 assert(write_to_log == wtl_android);
40 assert(limiter_created);
41 assert(dynamic_config_called);
43 limiter_ret = (struct pass_log_result) { .decision = DECISION_DENIED };
44 assert(dlog_print(DLOG_ERROR, "tag", "msg") == 45835705);
45 assert(__dlog_print(LOG_ID_MAIN, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NONE);
46 limiter_ret = (struct pass_log_result) { .decision = DECISION_TAG_LIMIT_EXCEEDED_MESSAGE };
47 assert(dlog_print(DLOG_ERROR, "tag", "msg") == 45835705);
48 assert(__dlog_print(LOG_ID_MAIN, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NONE);
50 assert(__dlog_print(LOG_ID_MAIN, DLOG_DEBUG, "tag", "msg") == DLOG_ERROR_NONE); // limited
52 assert(__dlog_sec_print(LOG_ID_MAIN, DLOG_DEBUG, "tag", "msg") == DLOG_ERROR_NONE); // limited
55 log_config_set(&CONFIG, "enable_secure_logs", "0");
56 assert(__dlog_sec_print(LOG_ID_MAIN, DLOG_DEBUG, "tag", "msg") == 0);
57 assert(__dlog_sec_print(LOG_ID_MAIN, DLOG_DEBUG, "tag", "msg") == 0);
59 limiter_ret = (struct pass_log_result) { .decision = DECISION_ALLOWED };
61 log_config_set(&CONFIG, "enable_system", "0");
63 assert(__dlog_print(LOG_ID_SYSTEM, DLOG_ERROR, "tag", "msg") == DLOG_ERROR_NONE);