blob: a299237962cc4d6b7ba00c1e6183b7e0f51eeda5 [file] [log] [blame]
Willy Tarreau4151c752019-08-08 18:21:26 +02001/*
2 * include/proto/trace.h
3 * This file provides functions for runtime tracing
4 *
5 * Copyright (C) 2000-2019 Willy Tarreau - w@1wt.eu
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _PROTO_TRACE_H
23#define _PROTO_TRACE_H
24
25#include <common/buffer.h>
26#include <common/compat.h>
27#include <common/config.h>
28#include <common/ist.h>
29#include <common/mini-clist.h>
30#include <types/log.h>
31#include <types/sink.h>
32#include <types/trace.h>
33
34extern struct list trace_sources;
Willy Tarreau88ebd402019-08-19 15:55:34 +020035extern THREAD_LOCAL struct buffer trace_buf;
Willy Tarreau4151c752019-08-08 18:21:26 +020036
37/* registers trace source <source>. Modifies the list element!
38 * The {start,pause,stop,report} events are not changed so the source may
39 * preset them.
40 */
41static inline void trace_register_source(struct trace_source *source)
42{
43 source->lockon = TRACE_LOCKON_NOTHING;
44 source->level = TRACE_LEVEL_USER;
45 source->detail_level = LOG_NOTICE;
46 source->sink = NULL;
47 source->state = TRACE_STATE_STOPPED;
48 source->lockon_ptr = NULL;
49 LIST_ADDQ(&trace_sources, &source->source_link);
50}
51
52#endif /* _PROTO_TRACE_H */
53
54/*
55 * Local variables:
56 * c-indent-level: 8
57 * c-basic-offset: 8
58 * End:
59 */