Eric Wild | 901f689 | 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 | * |
Eric Wild | 901f689 | 2022-05-07 15:36:47 +0200 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #include <osmocom/core/application.h> |
| 21 | #include <osmocom/core/logging.h> |
| 22 | #include <osmocom/core/utils.h> |
| 23 | |
Eric | e29b3c8 | 2022-10-27 16:54:09 +0200 | [diff] [blame] | 24 | #include <osmocom/bb/trxcon/logging.h> |
Eric Wild | 901f689 | 2022-05-07 15:36:47 +0200 | [diff] [blame] | 25 | |
| 26 | static struct log_info_cat trx_log_info_cat[] = { |
| 27 | [DAPP] = { |
| 28 | .name = "DAPP", |
| 29 | .description = "Application", |
| 30 | .color = "\033[1;35m", |
| 31 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 32 | }, |
| 33 | [DL1C] = { |
| 34 | .name = "DL1C", |
| 35 | .description = "Layer 1 control interface", |
| 36 | .color = "\033[1;31m", |
| 37 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 38 | }, |
| 39 | [DL1D] = { |
| 40 | .name = "DL1D", |
| 41 | .description = "Layer 1 data", |
| 42 | .color = "\033[1;31m", |
| 43 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 44 | }, |
Eric | e29b3c8 | 2022-10-27 16:54:09 +0200 | [diff] [blame] | 45 | [DTRXC] = { |
| 46 | .name = "DTRXC", |
Eric Wild | 901f689 | 2022-05-07 15:36:47 +0200 | [diff] [blame] | 47 | .description = "Transceiver control interface", |
| 48 | .color = "\033[1;33m", |
| 49 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 50 | }, |
| 51 | [DTRXD] = { |
| 52 | .name = "DTRXD", |
| 53 | .description = "Transceiver data interface", |
| 54 | .color = "\033[1;33m", |
| 55 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 56 | }, |
| 57 | [DSCH] = { |
| 58 | .name = "DSCH", |
| 59 | .description = "Scheduler management", |
| 60 | .color = "\033[1;36m", |
Eric | 847de6d | 2022-10-27 16:54:53 +0200 | [diff] [blame] | 61 | .enabled = 0, .loglevel = LOGL_NOTICE, |
Eric Wild | 901f689 | 2022-05-07 15:36:47 +0200 | [diff] [blame] | 62 | }, |
| 63 | [DSCHD] = { |
| 64 | .name = "DSCHD", |
| 65 | .description = "Scheduler data", |
| 66 | .color = "\033[1;36m", |
| 67 | .enabled = 1, .loglevel = LOGL_NOTICE, |
| 68 | }, |
| 69 | }; |
| 70 | |
| 71 | static const struct log_info trx_log_info = { |
| 72 | .cat = trx_log_info_cat, |
| 73 | .num_cat = ARRAY_SIZE(trx_log_info_cat), |
| 74 | }; |
| 75 | |
| 76 | int trx_log_init(void *tall_ctx, const char *category_mask) |
| 77 | { |
| 78 | osmo_init_logging2(tall_ctx, &trx_log_info); |
| 79 | |
| 80 | if (category_mask) |
| 81 | log_parse_category_mask(osmo_stderr_target, category_mask); |
| 82 | |
| 83 | return 0; |
| 84 | } |