Add logging.c/logging.h
This commit is contained in:
parent
31f8451c7b
commit
32d558701a
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ CFLAGS=-Wall -DPACKAGE_VERSION=\"0.0\"
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -o $@ -c $^
|
$(CC) $(CFLAGS) -o $@ -c $^
|
||||||
|
|
||||||
v5le: main.o v5x_data.o lapv5.o
|
v5le: main.o logging.o v5x_data.o lapv5.o
|
||||||
$(CC) -o $@ $^ $(LIBS)
|
$(CC) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
|
static const struct log_info_cat log_categories[] = {
|
||||||
|
[DV5] = {
|
||||||
|
.name = "DV5",
|
||||||
|
.description = "V5 protocol",
|
||||||
|
.color = "\033[1;33m",
|
||||||
|
.enabled = 1, .loglevel = LOGL_DEBUG,
|
||||||
|
},
|
||||||
|
[DV5CTRL] = {
|
||||||
|
.name = "DV5CTRL",
|
||||||
|
.description = "V5 control protocol",
|
||||||
|
.color = "\033[0;35m",
|
||||||
|
.enabled = 1, .loglevel = LOGL_DEBUG,
|
||||||
|
},
|
||||||
|
[DV5EF] = {
|
||||||
|
.name = "DV5EF",
|
||||||
|
.description = "V5 envelop frame",
|
||||||
|
.color = "\033[1;34m",
|
||||||
|
.enabled = 1, .loglevel = LOGL_DEBUG,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct log_info log_info = {
|
||||||
|
.cat = log_categories,
|
||||||
|
.num_cat = ARRAY_SIZE(log_categories),
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <osmocom/core/logging.h>
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DV5,
|
||||||
|
DV5CTRL,
|
||||||
|
DV5EF,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const struct log_info log_info;
|
10
main.c
10
main.c
|
@ -34,7 +34,6 @@
|
||||||
#include <osmocom/core/select.h>
|
#include <osmocom/core/select.h>
|
||||||
#include <osmocom/core/stats.h>
|
#include <osmocom/core/stats.h>
|
||||||
#include <osmocom/core/rate_ctr.h>
|
#include <osmocom/core/rate_ctr.h>
|
||||||
#include <osmocom/core/logging.h>
|
|
||||||
#include <osmocom/core/socket.h>
|
#include <osmocom/core/socket.h>
|
||||||
|
|
||||||
#include <osmocom/ctrl/control_vty.h>
|
#include <osmocom/ctrl/control_vty.h>
|
||||||
|
@ -49,6 +48,7 @@
|
||||||
|
|
||||||
#include <osmocom/abis/abis.h>
|
#include <osmocom/abis/abis.h>
|
||||||
|
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
@ -250,14 +250,6 @@ static struct vty_app_info vty_info = {
|
||||||
.is_config_node = v5le_vty_is_config_node,
|
.is_config_node = v5le_vty_is_config_node,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct log_info_cat log_categories[] = {
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct log_info log_info = {
|
|
||||||
.cat = log_categories,
|
|
||||||
.num_cat = ARRAY_SIZE(log_categories),
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
Loading…
Reference in New Issue