picow-http
0.12.1-4-g9d4fd13
HTTP server for the Raspberry Pi PicoW
log.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022 Geoff Simmons <geoff@simmons.de>
3
*
4
* SPDX-License-Identifier: BSD-2-Clause
5
* See LICENSE
6
*/
7
52
#ifndef _PICOW_HTTP_LOG_H
53
#define _PICOW_HTTP_LOG_H
54
55
#include <stdio.h>
56
#include <stdarg.h>
57
65
#define HTTP_LOG_LVL_NONE (-1)
70
#define HTTP_LOG_LVL_ERROR (0)
75
#define HTTP_LOG_LVL_WARN (1)
80
#define HTTP_LOG_LVL_INFO (2)
85
#define HTTP_LOG_LVL_DEBUG (3)
90
#define HTTP_LOG_LVL_VERBOSE (4)
91
134
#ifndef HTTP_LOG_LVL
135
# ifdef NDEBUG
136
# define HTTP_LOG_LVL (HTTP_LOG_LVL_INFO)
137
# else
138
# define HTTP_LOG_LVL (HTTP_LOG_LVL_DEBUG)
139
# endif
140
#endif
141
155
#ifndef HTTP_REQUEST_LOG
156
# if HTTP_LOG_LVL == HTTP_LOG_LVL_NONE
157
# define HTTP_REQUEST_LOG (0)
158
# else
159
# define HTTP_REQUEST_LOG (1)
160
# endif
161
#endif
162
184
#define HTTP_LOG(LVL, ...) do { \
185
if ((LVL) <= (HTTP_LOG_LVL)) \
186
http_log(__VA_ARGS__); \
187
} while (0)
188
213
#define HTTP_LOG_ERROR(...) HTTP_LOG(HTTP_LOG_LVL_ERROR, __VA_ARGS__)
214
239
#define HTTP_LOG_WARN(...) HTTP_LOG(HTTP_LOG_LVL_WARN, __VA_ARGS__)
240
285
#define HTTP_LOG_INFO(...) HTTP_LOG(HTTP_LOG_LVL_INFO, __VA_ARGS__)
286
297
#define HTTP_LOG_DEBUG(...) HTTP_LOG(HTTP_LOG_LVL_DEBUG, __VA_ARGS__)
298
308
#define HTTP_LOG_VERBOSE(...) HTTP_LOG(HTTP_LOG_LVL_VERBOSE, __VA_ARGS__)
309
320
static
inline
void
321
http_log
(
const
char
*fmt, ...)
322
{
323
va_list ap;
324
325
va_start(ap, fmt);
326
vprintf(fmt, ap);
327
va_end(ap);
328
puts(
""
);
329
}
330
331
#endif
/* _PICOW_HTTP_LOG_H */
http_log
static void http_log(const char *fmt,...)
Print a log message.
Definition:
log.h:321
picow_http
log.h
Generated by
1.9.4