blob: 29be652bb254c0bf6f6df2c3b115d5008226d050 [file] [log] [blame]
Eric Wild901f6892022-05-07 15:36:47 +02001/*
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 Wild901f6892022-05-07 15:36:47 +020018 */
19
20#include <osmocom/core/application.h>
21#include <osmocom/core/logging.h>
22#include <osmocom/core/utils.h>
23
Erice29b3c82022-10-27 16:54:09 +020024#include <osmocom/bb/trxcon/logging.h>
Eric Wild901f6892022-05-07 15:36:47 +020025
26static 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 },
Erice29b3c82022-10-27 16:54:09 +020045 [DTRXC] = {
46 .name = "DTRXC",
Eric Wild901f6892022-05-07 15:36:47 +020047 .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",
Eric847de6d2022-10-27 16:54:53 +020061 .enabled = 0, .loglevel = LOGL_NOTICE,
Eric Wild901f6892022-05-07 15:36:47 +020062 },
63 [DSCHD] = {
64 .name = "DSCHD",
65 .description = "Scheduler data",
66 .color = "\033[1;36m",
67 .enabled = 1, .loglevel = LOGL_NOTICE,
68 },
69};
70
71static const struct log_info trx_log_info = {
72 .cat = trx_log_info_cat,
73 .num_cat = ARRAY_SIZE(trx_log_info_cat),
74};
75
76int 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}