Eric Wild | d40300e | 2022-05-07 15:36:47 +0200 | [diff] [blame] | 1 | /* |
| 2 | * OsmocomBB <-> SDR connection bridge |
| 3 | * |
| 4 | * (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com> |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <osmocom/core/application.h> |
| 25 | #include <osmocom/core/logging.h> |
| 26 | #include <osmocom/core/utils.h> |
| 27 | |
| 28 | #include "logging.h" |
| 29 | |
| 30 | static struct log_info_cat trx_log_info_cat[] = { |
| 31 | [DAPP] = { |
| 32 | .name = "DAPP", |
| 33 | .description = "Application", |
| 34 | .color = "\033[1;35m", |
| 35 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 36 | }, |
| 37 | [DL1C] = { |
| 38 | .name = "DL1C", |
| 39 | .description = "Layer 1 control interface", |
| 40 | .color = "\033[1;31m", |
| 41 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 42 | }, |
| 43 | [DL1D] = { |
| 44 | .name = "DL1D", |
| 45 | .description = "Layer 1 data", |
| 46 | .color = "\033[1;31m", |
| 47 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 48 | }, |
| 49 | [DTRX] = { |
| 50 | .name = "DTRX", |
| 51 | .description = "Transceiver control interface", |
| 52 | .color = "\033[1;33m", |
| 53 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 54 | }, |
| 55 | [DTRXD] = { |
| 56 | .name = "DTRXD", |
| 57 | .description = "Transceiver data interface", |
| 58 | .color = "\033[1;33m", |
| 59 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 60 | }, |
| 61 | [DSCH] = { |
| 62 | .name = "DSCH", |
| 63 | .description = "Scheduler management", |
| 64 | .color = "\033[1;36m", |
Eric | 935c8cb | 2022-06-06 00:48:09 +0200 | [diff] [blame] | 65 | .enabled = 0, .loglevel = LOGL_NOTICE, |
Eric Wild | d40300e | 2022-05-07 15:36:47 +0200 | [diff] [blame] | 66 | }, |
| 67 | [DSCHD] = { |
| 68 | .name = "DSCHD", |
| 69 | .description = "Scheduler data", |
| 70 | .color = "\033[1;36m", |
| 71 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 72 | }, |
| 73 | }; |
| 74 | |
| 75 | static const struct log_info trx_log_info = { |
| 76 | .cat = trx_log_info_cat, |
| 77 | .num_cat = ARRAY_SIZE(trx_log_info_cat), |
| 78 | }; |
| 79 | |
| 80 | int trx_log_init(void *tall_ctx, const char *category_mask) |
| 81 | { |
| 82 | osmo_init_logging2(tall_ctx, &trx_log_info); |
| 83 | |
| 84 | if (category_mask) |
| 85 | log_parse_category_mask(osmo_stderr_target, category_mask); |
| 86 | |
| 87 | return 0; |
| 88 | } |