dlog
Logging framework
Loading...
Searching...
No Matches
dlog.h
Go to the documentation of this file.
1/* MIT License
2 *
3 * Copyright (c) 2012-2020 Samsung Electronics Co., Ltd
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is furnished
10 * to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE. */
22
23
30
31
32#ifndef _DLOG_H_
33#define _DLOG_H_
34
35#include <stdarg.h>
36#include <string.h>
37#include <tizen_error.h>
38/*
39 * This is for checking dlog_print format string.
40 */
41#pragma GCC diagnostic warning "-Wformat"
42#include "dlog-internal.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
48
49/*
50 * This is the local tag used for the following simplified
51 * logging macros. You can change this preprocessor definition
52 * before using the other macros to change the tag.
53 */
54#ifndef LOG_TAG
55#define LOG_TAG NULL
56#endif
57
58
64
65
71typedef enum {
72 DLOG_ERROR_NONE = TIZEN_ERROR_NONE,
73 DLOG_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
74 DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED
76
77
81
82
87
88
95typedef enum {
97 DLOG_UNKNOWN = 0,
98 DLOG_DEFAULT, // doesn't seem actually used or translated into any other level
108 DLOG_PRIO_MAX
111
112/* TODO: developers notoriously misuse ERROR as a generic "high priority" tag,
113 * even for things that aren't actually errors. Consider adding some sort of
114 * `DLOG_INFO_HIGH` or something that would retain the benefits of `DLOG_ERROR`,
115 * i.e. be high enough to pass default filters and (green?) coloring in dlogutil. */
116
120
121
126
127
156int dlog_print(log_priority prio, const char *tag, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
157
158
194int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap);
195
199
200
201#ifdef __cplusplus
202}
203#endif /* __cplusplus */
204#endif /* _DLOG_H_*/
dlog_error_e
Enumeration for Dlog Errors, returned by API calls.
Definition dlog.h:71
log_priority
Enumeration for log priority values in ascending priority order.
Definition dlog.h:95
int int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap)
Sends a log message with given priority and tag label, using variadic args.
int dlog_print(log_priority prio, const char *tag, const char *fmt,...) __attribute__((format(printf
Sends a log message with given priority and tag, using printf formatting.
@ DLOG_ERROR_NONE
Definition dlog.h:72
@ DLOG_ERROR_NOT_PERMITTED
Definition dlog.h:74
@ DLOG_ERROR_INVALID_PARAMETER
Definition dlog.h:73
@ DLOG_FATAL
Definition dlog.h:105
@ DLOG_ERROR
Definition dlog.h:104
@ DLOG_VERBOSE
Definition dlog.h:100
@ DLOG_WARN
Definition dlog.h:103
@ DLOG_SILENT
Definition dlog.h:106
@ DLOG_INFO
Definition dlog.h:102
@ DLOG_DEBUG
Definition dlog.h:101