blob: af397e023c8e4bb2e7011cffc7fa074663970aad [file] [log] [blame]
Ericb7253c62022-11-28 19:21:08 +01001/*
Eric1499f032023-07-25 18:42:48 +02002 * OsmocomBB <-> SDR connection bridge
3 *
4 * (C) 2016-2017 by Vadim Yanitskiy <axilirator@gmail.com>
Ericb7253c62022-11-28 19:21:08 +01005 *
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 */
19
20#include <osmocom/core/application.h>
21#include <osmocom/core/logging.h>
22#include <osmocom/core/utils.h>
23
Ericb7253c62022-11-28 19:21:08 +010024#include <osmocom/bb/trxcon/trxcon.h>
Eric1499f032023-07-25 18:42:48 +020025#include <osmocom/bb/trxcon/logging.h>
Ericb7253c62022-11-28 19:21:08 +010026
27static struct log_info_cat trxcon_log_info_cat[] = {
28 [DAPP] = {
29 .name = "DAPP",
Ericb7253c62022-11-28 19:21:08 +010030 .description = "Application",
Eric1499f032023-07-25 18:42:48 +020031 .color = "\033[1;35m",
32 .enabled = 1, .loglevel = LOGL_NOTICE,
Ericb7253c62022-11-28 19:21:08 +010033 },
34 [DL1C] = {
35 .name = "DL1C",
Ericb7253c62022-11-28 19:21:08 +010036 .description = "Layer 1 control interface",
Eric1499f032023-07-25 18:42:48 +020037 .color = "\033[1;31m",
38 .enabled = 1, .loglevel = LOGL_NOTICE,
Ericb7253c62022-11-28 19:21:08 +010039 },
40 [DL1D] = {
41 .name = "DL1D",
Ericb7253c62022-11-28 19:21:08 +010042 .description = "Layer 1 data",
Eric1499f032023-07-25 18:42:48 +020043 .color = "\033[1;31m",
44 .enabled = 1, .loglevel = LOGL_NOTICE,
45 },
46 [DTRXC] = {
47 .name = "DTRXC",
48 .description = "Transceiver control interface",
49 .color = "\033[1;33m",
50 .enabled = 1, .loglevel = LOGL_NOTICE,
51 },
52 [DTRXD] = {
53 .name = "DTRXD",
54 .description = "Transceiver data interface",
55 .color = "\033[1;33m",
56 .enabled = 1, .loglevel = LOGL_NOTICE,
Ericb7253c62022-11-28 19:21:08 +010057 },
58 [DSCH] = {
59 .name = "DSCH",
Ericb7253c62022-11-28 19:21:08 +010060 .description = "Scheduler management",
Eric1499f032023-07-25 18:42:48 +020061 .color = "\033[1;36m",
62 .enabled = 1, .loglevel = LOGL_NOTICE,
Ericb7253c62022-11-28 19:21:08 +010063 },
64 [DSCHD] = {
65 .name = "DSCHD",
Ericb7253c62022-11-28 19:21:08 +010066 .description = "Scheduler data",
Eric1499f032023-07-25 18:42:48 +020067 .color = "\033[1;36m",
68 .enabled = 1, .loglevel = LOGL_NOTICE,
69 },
70 [DGPRS] = {
71 .name = "DGPRS",
72 .description = "L1 GPRS (MAC layer)",
73 .color = "\033[1;36m",
74 .enabled = 1, .loglevel = LOGL_NOTICE,
Ericb7253c62022-11-28 19:21:08 +010075 },
76};
77
Eric1499f032023-07-25 18:42:48 +020078static const struct log_info trxcon_log_info = {
Ericb7253c62022-11-28 19:21:08 +010079 .cat = trxcon_log_info_cat,
80 .num_cat = ARRAY_SIZE(trxcon_log_info_cat),
81};
82
83static const int trxcon_log_cfg[] = {
84 [TRXCON_LOGC_FSM] = DAPP,
85 [TRXCON_LOGC_L1C] = DL1C,
86 [TRXCON_LOGC_L1D] = DL1D,
87 [TRXCON_LOGC_SCHC] = DSCH,
88 [TRXCON_LOGC_SCHD] = DSCHD,
Eric1499f032023-07-25 18:42:48 +020089 [TRXCON_LOGC_GPRS] = DGPRS,
Ericb7253c62022-11-28 19:21:08 +010090};
91
92void trxc_log_init(void *tallctx)
93{
94 osmo_init_logging2(tallctx, &trxcon_log_info);
Eric7d5c1652023-06-21 16:40:29 +020095 log_target_file_switch_to_wqueue(osmo_stderr_target);
Ericb7253c62022-11-28 19:21:08 +010096
97 trxcon_set_log_cfg(&trxcon_log_cfg[0], ARRAY_SIZE(trxcon_log_cfg));
98}