VirtualBox

source: vbox/trunk/src/libs/curl-8.7.1/lib/curl_trc.h@ 106542

最後變更 在這個檔案從106542是 104083,由 vboxsync 提交於 11 月 前

curl-8.7.1: Applied and adjusted our curl changes to 8.4.0. bugref:10639

檔案大小: 4.4 KB
 
1#ifndef HEADER_CURL_TRC_H
2#define HEADER_CURL_TRC_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Daniel Stenberg, <[email protected]>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26
27struct Curl_easy;
28struct Curl_cfilter;
29
30/**
31 * Init logging, return != 0 on failure.
32 */
33CURLcode Curl_trc_init(void);
34
35/**
36 * Configure tracing. May be called several times during global
37 * initialization. Later calls may not take effect.
38 *
39 * Configuration format supported:
40 * - comma-separated list of component names to enable logging on.
41 * E.g. 'http/2,ssl'. Unknown names are ignored. Names are compared
42 * case-insensitive.
43 * - component 'all' applies to all known log components
44 * - prefixing a component with '+' or '-' will en-/disable logging for
45 * that component
46 * Example: 'all,-ssl' would enable logging for all components but the
47 * SSL filters.
48 *
49 * @param config configuration string
50 */
51CURLcode Curl_trc_opt(const char *config);
52
53/* the function used to output verbose information */
54void Curl_debug(struct Curl_easy *data, curl_infotype type,
55 char *ptr, size_t size);
56
57/**
58 * Output a failure message on registered callbacks for transfer.
59 */
60void Curl_failf(struct Curl_easy *data,
61 const char *fmt, ...) CURL_PRINTF(2, 3);
62
63#define failf Curl_failf
64
65#define CURL_LOG_LVL_NONE 0
66#define CURL_LOG_LVL_INFO 1
67
68
69#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
70#define CURL_HAVE_C99
71#endif
72
73#ifdef CURL_HAVE_C99
74#define infof(data, ...) \
75 do { if(Curl_trc_is_verbose(data)) \
76 Curl_infof(data, __VA_ARGS__); } while(0)
77#define CURL_TRC_CF(data, cf, ...) \
78 do { if(Curl_trc_cf_is_verbose(cf, data)) \
79 Curl_trc_cf_infof(data, cf, __VA_ARGS__); } while(0)
80
81#else
82#define infof Curl_infof
83#define CURL_TRC_CF Curl_trc_cf_infof
84#endif
85
86#ifndef CURL_DISABLE_VERBOSE_STRINGS
87/* informational messages enabled */
88
89struct curl_trc_feat {
90 const char *name;
91 int log_level;
92};
93
94#define Curl_trc_is_verbose(data) \
95 ((data) && (data)->set.verbose && \
96 (!(data)->state.feat || \
97 ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO)))
98#define Curl_trc_cf_is_verbose(cf, data) \
99 (Curl_trc_is_verbose(data) && \
100 (cf) && (cf)->cft->log_level >= CURL_LOG_LVL_INFO)
101#define Curl_trc_ft_is_verbose(data, ft) \
102 (Curl_trc_is_verbose(data) && \
103 (ft)->log_level >= CURL_LOG_LVL_INFO)
104
105/**
106 * Output an informational message when transfer's verbose logging is enabled.
107 */
108void Curl_infof(struct Curl_easy *data,
109 const char *fmt, ...) CURL_PRINTF(2, 3);
110
111/**
112 * Output an informational message when both transfer's verbose logging
113 * and connection filters verbose logging are enabled.
114 */
115void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
116 const char *fmt, ...) CURL_PRINTF(3, 4);
117
118#else /* defined(CURL_DISABLE_VERBOSE_STRINGS) */
119/* All informational messages are not compiled in for size savings */
120
121#define Curl_trc_is_verbose(d) ((void)(d), FALSE)
122#define Curl_trc_cf_is_verbose(x,y) ((void)(x), (void)(y), FALSE)
123#define Curl_trc_ft_is_verbose(x,y) ((void)(x), (void)(y), FALSE)
124
125static void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
126{
127 (void)data; (void)fmt;
128}
129
130static void Curl_trc_cf_infof(struct Curl_easy *data,
131 struct Curl_cfilter *cf,
132 const char *fmt, ...)
133{
134 (void)data; (void)cf; (void)fmt;
135}
136
137#endif /* !defined(CURL_DISABLE_VERBOSE_STRINGS) */
138
139#endif /* HEADER_CURL_TRC_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette