| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright 2019 Philippe Proulx <pproulx@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef CLI_BABELTRACE_LOG_LEVEL_H |
| 8 | #define CLI_BABELTRACE_LOG_LEVEL_H |
| 9 | |
| 10 | #include <babeltrace2/babeltrace.h> |
| 11 | |
| 12 | #define ENV_BABELTRACE_CLI_LOG_LEVEL "BABELTRACE_CLI_LOG_LEVEL" |
| 13 | |
| 14 | /* |
| 15 | * Return the minimal (most verbose) log level between `a` and `b`. |
| 16 | * |
| 17 | * If one of the parameter has the value -1, it is ignored in the comparison |
| 18 | * and the other value is returned. If both parameters are -1, -1 is returned. |
| 19 | */ |
| 20 | static inline |
| 21 | int logging_level_min(int a, int b) |
| 22 | { |
| 23 | if (a == -1) { |
| 24 | return b; |
| 25 | } else if (b == -1) { |
| 26 | return a; |
| 27 | } else { |
| 28 | return MIN(a, b); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | void set_auto_log_levels(int *logging_level); |
| 33 | |
| 34 | #endif /* CLI_BABELTRACE_LOG_LEVEL_H */ |