Eric | a0e1ed3 | 2022-11-28 19:21:08 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2022 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> |
| 3 | * All Rights Reserved |
| 4 | * |
| 5 | * Author: Eric Wild <ewild@sysmocom.de> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU Affero General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program 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 |
| 15 | * GNU Affero General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Affero General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | extern "C" { |
| 23 | #include <osmocom/core/application.h> |
| 24 | #include <osmocom/bb/trxcon/logging.h> |
| 25 | #include <osmocom/bb/trxcon/trxcon.h> |
| 26 | #include <osmocom/bb/l1sched/l1sched.h> |
| 27 | |
| 28 | } |
| 29 | static const int trxcon_log_cfg[] = { |
| 30 | [TRXCON_LOGC_FSM] = DAPP, |
| 31 | [TRXCON_LOGC_L1C] = DL1C, |
| 32 | [TRXCON_LOGC_L1D] = DL1D, |
| 33 | [TRXCON_LOGC_SCHC] = DSCH, |
| 34 | [TRXCON_LOGC_SCHD] = DSCHD, |
| 35 | }; |
| 36 | |
| 37 | static struct log_info_cat trxcon_log_info_cat[] = { |
| 38 | [DAPP] = { |
| 39 | .name = "DAPP", |
| 40 | .color = "\033[1;35m", |
| 41 | .description = "Application", |
| 42 | .loglevel = LOGL_NOTICE, .enabled = 1, |
| 43 | }, |
| 44 | [DL1C] = { |
| 45 | .name = "DL1C", |
| 46 | .color = "\033[1;31m", |
| 47 | .description = "Layer 1 control interface", |
| 48 | .loglevel = LOGL_NOTICE, .enabled = 1, |
| 49 | }, |
| 50 | [DL1D] = { |
| 51 | .name = "DL1D", |
| 52 | .color = "\033[1;31m", |
| 53 | .description = "Layer 1 data", |
| 54 | .loglevel = LOGL_NOTICE, |
| 55 | .enabled = 1, |
| 56 | }, |
| 57 | [DTRXC] = { |
| 58 | .name = "DTRXC", |
| 59 | .color = "\033[1;33m", |
| 60 | .description = "Transceiver control interface", |
| 61 | .loglevel = LOGL_NOTICE, |
| 62 | .enabled = 1, |
| 63 | }, |
| 64 | [DTRXD] = { |
| 65 | .name = "DTRXD", |
| 66 | .color = "\033[1;33m", |
| 67 | .description = "Transceiver data interface", |
| 68 | .loglevel = LOGL_NOTICE, |
| 69 | .enabled = 1, |
| 70 | }, |
| 71 | [DSCH] = { |
| 72 | .name = "DSCH", |
| 73 | .color = "\033[1;36m", |
| 74 | .description = "Scheduler management", |
| 75 | .loglevel = LOGL_NOTICE, |
| 76 | .enabled = 0, |
| 77 | }, |
| 78 | [DSCHD] = { |
| 79 | .name = "DSCHD", |
| 80 | .color = "\033[1;36m", |
| 81 | .description = "Scheduler data", |
| 82 | .loglevel = LOGL_NOTICE, |
| 83 | .enabled = 0, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | static struct log_info trxcon_log_info = { |
| 88 | .cat = trxcon_log_info_cat, |
| 89 | .num_cat = ARRAY_SIZE(trxcon_log_info_cat), |
| 90 | }; |
| 91 | |
| 92 | namespace trxcon |
| 93 | { |
| 94 | |
| 95 | void trxc_log_init(void *tallctx) |
| 96 | { |
| 97 | osmo_init_logging2(tallctx, &trxcon_log_info); |
| 98 | // log_parse_category_mask(osmo_stderr_target, ""); |
| 99 | |
| 100 | trxcon_set_log_cfg(&trxcon_log_cfg[0], ARRAY_SIZE(trxcon_log_cfg)); |
| 101 | } |
| 102 | |
| 103 | } // namespace trxcon |