[LICENSE] change to Flora-1.1 license
[profile/tv/apps/native/screen-reader.git] / src / logger.c
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * This file is a modified version of BSD licensed file and
5  * licensed under the Flora License, Version 1.1 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * Please, see the LICENSE file for the original copyright owner and
18  * license.
19  */
20
21 #include "logger.h"
22
23 int _eina_log_dom;
24
25 #define SCREEN_READER_LOG_DOMAIN_NAME "screen-reader"
26
27 int logger_init(void)
28 {
29    eina_init();
30
31    if (!_eina_log_dom)
32       {
33          _eina_log_dom = eina_log_domain_register(SCREEN_READER_LOG_DOMAIN_NAME, NULL);
34          if (_eina_log_dom  < 0)
35             {
36                fprintf(stderr, "Unable to register screen-reader log domain");
37                return -1;
38             }
39          eina_log_domain_level_set(SCREEN_READER_LOG_DOMAIN_NAME, EINA_LOG_LEVEL_DBG);
40       }
41    return 0;
42 }
43
44 void logger_shutdown(void)
45 {
46    eina_shutdown();
47
48    if (_eina_log_dom)
49       {
50          eina_log_domain_unregister(_eina_log_dom);
51          _eina_log_dom = 0;
52       }
53 }
54