| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-only |
| 3 | * |
| 4 | * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #include "common/logging.h" |
| 8 | |
| 9 | volatile enum lttng_ust_log_level lttng_ust_log_level; |
| 10 | |
| 11 | void lttng_ust_logging_init(void) |
| 12 | { |
| 13 | char *lttng_ust_debug; |
| 14 | |
| 15 | if (lttng_ust_log_level == LTTNG_UST_LOG_LEVEL_UNKNOWN) { |
| 16 | /* |
| 17 | * This getenv is not part of lttng_ust_getenv() because it |
| 18 | * is required to print ERR() performed during getenv |
| 19 | * initialization. |
| 20 | */ |
| 21 | lttng_ust_debug = getenv("LTTNG_UST_DEBUG"); |
| 22 | if (lttng_ust_debug) |
| 23 | lttng_ust_log_level = LTTNG_UST_LOG_LEVEL_DEBUG; |
| 24 | else |
| 25 | lttng_ust_log_level = LTTNG_UST_LOG_LEVEL_NORMAL; |
| 26 | } |
| 27 | } |