libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-log-ship.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2026 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
52
53struct lws_log_ship;
54
58typedef struct lws_log_ship_line {
59 uint64_t seq;
60 uint64_t t_us;
61 const char *text;
62 const char *tag;
64 size_t len;
65 int level;
67
80typedef int (*lws_log_ship_tagger_t)(const char *line, size_t len, char *tag,
81 size_t tag_len);
82
97typedef void (*lws_log_ship_store_cb_t)(void *opaque, const char *kind,
98 const char *host, const char *inst,
99 const lws_log_ship_line_t *lines,
100 size_t count);
101
106 struct lws_vhost *vhost;
110 const char *url;
115 const char *secret;
117 const char *kind;
120 const char *host;
127 void *opaque;
136};
137
147LWS_VISIBLE LWS_EXTERN struct lws_log_ship *
149
161lws_log_ship_link(struct lws_log_ship *ls, const char *url,
162 const char *secret);
163
174lws_log_ship_set_host(struct lws_log_ship *ls, const char *host);
175
187
197lws_log_ship_destroy(struct lws_log_ship **pls);
198
214lws_log_ship_window(struct lws_log_ship *ls, uint64_t from_us,
215 uint64_t until_us, int lvl);
216
224LWS_VISIBLE LWS_EXTERN struct lws_log_ship *
226
235LWS_VISIBLE LWS_EXTERN const char *
236lws_log_ship_inst(struct lws_log_ship *ls);
237
243LWS_VISIBLE LWS_EXTERN const char *
244lws_log_ship_host(struct lws_log_ship *ls);
245
249LWS_VISIBLE LWS_EXTERN uint64_t
251
252/* the protocol names on the wire */
253#define LWS_LOG_SHIP_WS_PROTOCOL "lws-log-ingest"
254#define LWS_LOG_SHIP_LINE_MAX 1024
255
const char * url
const char * host
const char * secret
lws_log_ship_store_cb_t store
const char * tag
const char * text
const char * kind
struct lws_vhost * vhost
LWS_VISIBLE LWS_EXTERN struct lws_log_ship * lws_log_ship_get(void)
LWS_VISIBLE LWS_EXTERN void lws_log_ship_set_tagger(lws_log_ship_tagger_t tagger)
LWS_VISIBLE LWS_EXTERN int lws_log_ship_set_host(struct lws_log_ship *ls, const char *host)
int(* lws_log_ship_tagger_t)(const char *line, size_t len, char *tag, size_t tag_len)
LWS_VISIBLE LWS_EXTERN uint64_t lws_log_ship_utc_us(void)
LWS_VISIBLE LWS_EXTERN void lws_log_ship_destroy(struct lws_log_ship **pls)
struct lws_log_ship_line lws_log_ship_line_t
LWS_VISIBLE LWS_EXTERN const char * lws_log_ship_inst(struct lws_log_ship *ls)
void(* lws_log_ship_store_cb_t)(void *opaque, const char *kind, const char *host, const char *inst, const lws_log_ship_line_t *lines, size_t count)
LWS_VISIBLE LWS_EXTERN const char * lws_log_ship_host(struct lws_log_ship *ls)
LWS_VISIBLE LWS_EXTERN void lws_log_ship_window(struct lws_log_ship *ls, uint64_t from_us, uint64_t until_us, int lvl)
LWS_VISIBLE LWS_EXTERN int lws_log_ship_link(struct lws_log_ship *ls, const char *url, const char *secret)
LWS_VISIBLE LWS_EXTERN struct lws_log_ship * lws_log_ship_create(const struct lws_log_ship_info *info)
#define LWS_EXTERN
#define LWS_VISIBLE