2 * Copyright (c) 2016 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 #define MAX_PATH_LEN 1024
18 #define MAX_MSG_LEN 1024
20 #define _STRINGIFY(x) #x
21 #define STRINGIFY(x) _STRINGIFY(x)
23 #define MAX_PATH_LEN_STR STRINGIFY(MAX_PATH_LEN)
24 #define MAX_MSG_LEN_STR STRINGIFY(MAX_MSG_LEN)
26 #define LOG_MODE_NONE 0
27 #define LOG_MODE_FILE 1
29 # define LOG_MODE_STDERR (LOG_MODE_FILE << 1)
30 # define LOG_MODE_DLOG (LOG_MODE_FILE << 2)
33 /* Enumeration for terminal colors. Used in internal _printf() function */
40 /* Sets globally the mode of logging. mode has to be specified as a single or
41 combination of the following defines:
42 LOG_MODE_NONE - no logging;
43 LOG_MODE_FILE - logging to the file;
44 LOG_MODE_STDERR - logging to the standart error stream;
45 LOG_MODE_DLOG - logging to the dlog.
46 For example, set_logging_mode(LOG_MODE_FILE | LOG_MODE_DLOG) call will
47 direct all following logging to both file and dlog daemon */
48 void _logger_set_logging_mode(int mode);
50 /* Sets globally the name of the file for LOG_MODE_FILE logging mode */
51 int _logger_set_file(const char *fname);
53 /* Sets globally the log tag will be used in logging journals like Tizen dlog */
54 int _logger_set_log_tag(const char *tag);
56 /* Functions for corresponding logging: */
57 int _logger_log_info(const char *fmt, ...);
58 int _logger_log_warn(const char *fmt, ...);
59 int _logger_log_err(const char *fmt, ...);
61 /* Function for using instead of standard printf() if coloring is needed */
62 int _printf(_cmd_color_e color, const char *fmt, ...);