Tests: Fix: Use '.logfile' instead of '.log' for test app output
[lttng-tools.git] / include / lttng / log-level-rule.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_LOG_LEVEL_RULE_H
9#define LTTNG_LOG_LEVEL_RULE_H
10
11#include <lttng/lttng-export.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17struct lttng_log_level_rule;
18
19enum lttng_log_level_rule_type {
20 LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN = -1,
21 LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY = 0,
22 LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS = 1,
23};
24
25enum lttng_log_level_rule_status {
26 LTTNG_LOG_LEVEL_RULE_STATUS_OK = 0,
27 LTTNG_LOG_LEVEL_RULE_STATUS_ERROR = -1,
28 LTTNG_LOG_LEVEL_RULE_STATUS_INVALID = -3,
29};
30
31/*
32 * Returns the type of the log level rule `rule`, or:
33 *
34 * `LTTNG_LOG_LEVEL_RULE_TYPE_UNKNOWN`:
35 * `rule` is `NULL`.
36 */
37LTTNG_EXPORT extern enum lttng_log_level_rule_type
38lttng_log_level_rule_get_type(const struct lttng_log_level_rule *rule);
39
40/*
41 * Creates a log level rule for which a log level must match exactly `level` to
42 * be considered.
43 *
44 * Returns `NULL` if:
45 *
46 * * There's a memory error.
47 *
48 * The returned log level rule must be destroyed using
49 * lttng_log_level_rule_destroy().
50 */
51LTTNG_EXPORT extern struct lttng_log_level_rule *lttng_log_level_rule_exactly_create(int level);
52
53/*
54 * Sets `level` to the level of the "exactly" log level rule `rule`.
55 *
56 * Returns:
57 *
58 * `LTTNG_LOG_LEVEL_RULE_STATUS_OK`:
59 * Success.
60 *
61 * `LTTNG_LOG_LEVEL_RULE_STATUS_INVALID`:
62 * * `rule` is NULL.
63 * * `level` is NULL.
64 * * The type of `rule` is not `LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY`.
65 */
66LTTNG_EXPORT extern enum lttng_log_level_rule_status
67lttng_log_level_rule_exactly_get_level(const struct lttng_log_level_rule *rule, int *level);
68
69/*
70 * Creates a log level rule for which a log level must be at least as severe as
71 * `level` to be considered.
72 *
73 * Returns `NULL` if:
74 *
75 * * There's a memory error.
76 *
77 * The returned log level rule must be destroyed using
78 * lttng_log_level_rule_destroy().
79 */
80LTTNG_EXPORT extern struct lttng_log_level_rule *
81lttng_log_level_rule_at_least_as_severe_as_create(int level);
82
83/*
84 * Sets `level` to the level of the "at least as severe as" log level rule
85 * `rule`.
86 *
87 * Returns:
88 *
89 * `LTTNG_LOG_LEVEL_RULE_STATUS_OK`:
90 * Success.
91 *
92 * `LTTNG_LOG_LEVEL_RULE_STATUS_INVALID`:
93 * * `rule` is NULL.
94 * * `level` is NULL.
95 * * The type of `rule` is not
96 * `LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS`.
97 */
98LTTNG_EXPORT extern enum lttng_log_level_rule_status
99lttng_log_level_rule_at_least_as_severe_as_get_level(const struct lttng_log_level_rule *rule,
100 int *level);
101
102/*
103 * Destroy the log level rule `log_level_rule` if not `NULL`.
104 */
105LTTNG_EXPORT extern void lttng_log_level_rule_destroy(struct lttng_log_level_rule *log_level_rule);
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif /* LTTNG_LOG_LEVEL_RULE_H */
This page took 0.024893 seconds and 5 git commands to generate.