9
0
Fork 0
mirror of https://gerrit.osmocom.org/osmocom-bb synced 2024-08-08 11:06:24 +00:00

rename log_info to osmo_log_info to avoid namespace clash with app

This commit is contained in:
Harald Welte 2010-05-19 19:54:00 +02:00
parent 93cf5a38eb
commit 4ebdf74728
2 changed files with 17 additions and 17 deletions

View file

@ -37,7 +37,7 @@
#include <osmocore/utils.h> #include <osmocore/utils.h>
#include <osmocore/logging.h> #include <osmocore/logging.h>
const struct log_info *log_info; const struct log_info *osmo_log_info;
static struct log_context log_context; static struct log_context log_context;
static void *tall_log_ctx = NULL; static void *tall_log_ctx = NULL;
@ -67,8 +67,8 @@ int log_parse_category(const char *category)
{ {
int i; int i;
for (i = 0; i < log_info->num_cat; ++i) { for (i = 0; i < osmo_log_info->num_cat; ++i) {
if (!strcasecmp(log_info->cat[i].name+1, category)) if (!strcasecmp(osmo_log_info->cat[i].name+1, category))
return i; return i;
} }
@ -92,15 +92,15 @@ void log_parse_category_mask(struct log_target* target, const char *_mask)
category_token = strtok(mask, ":"); category_token = strtok(mask, ":");
do { do {
for (i = 0; i < log_info->num_cat; ++i) { for (i = 0; i < osmo_log_info->num_cat; ++i) {
char* colon = strstr(category_token, ","); char* colon = strstr(category_token, ",");
int length = strlen(category_token); int length = strlen(category_token);
if (colon) if (colon)
length = colon - category_token; length = colon - category_token;
if (strncasecmp(log_info->cat[i].name, category_token, if (strncasecmp(osmo_log_info->cat[i].name,
length) == 0) { category_token, length) == 0) {
int level = 0; int level = 0;
if (colon) if (colon)
@ -117,8 +117,8 @@ void log_parse_category_mask(struct log_target* target, const char *_mask)
static const char* color(int subsys) static const char* color(int subsys)
{ {
if (subsys < log_info->num_cat) if (subsys < osmo_log_info->num_cat)
return log_info->cat[subsys].color; return osmo_log_info->cat[subsys].color;
return NULL; return NULL;
} }
@ -198,8 +198,8 @@ static void _logp(unsigned int subsys, int level, char *file, int line,
* say stop, continue, output */ * say stop, continue, output */
if ((tar->filter_map & LOG_FILTER_ALL) != 0) if ((tar->filter_map & LOG_FILTER_ALL) != 0)
output = 1; output = 1;
else if (log_info->filter_fn) else if (osmo_log_info->filter_fn)
output = log_info->filter_fn(&log_context, output = osmo_log_info->filter_fn(&log_context,
tar); tar);
if (output) { if (output) {
@ -306,7 +306,7 @@ void log_set_log_level(struct log_target *target, int log_level)
void log_set_category_filter(struct log_target *target, int category, void log_set_category_filter(struct log_target *target, int category,
int enable, int level) int enable, int level)
{ {
if (category >= log_info->num_cat) if (category >= osmo_log_info->num_cat)
return; return;
target->categories[category].enabled = !!enable; target->categories[category].enabled = !!enable;
target->categories[category].loglevel = level; target->categories[category].loglevel = level;
@ -333,10 +333,10 @@ struct log_target *log_target_create(void)
INIT_LLIST_HEAD(&target->entry); INIT_LLIST_HEAD(&target->entry);
/* initialize the per-category enabled/loglevel from defaults */ /* initialize the per-category enabled/loglevel from defaults */
for (i = 0; i < log_info->num_cat; i++) { for (i = 0; i < osmo_log_info->num_cat; i++) {
struct log_category *cat = &target->categories[i]; struct log_category *cat = &target->categories[i];
cat->enabled = log_info->cat[i].enabled; cat->enabled = osmo_log_info->cat[i].enabled;
cat->loglevel = log_info->cat[i].loglevel; cat->loglevel = osmo_log_info->cat[i].loglevel;
} }
/* global settings */ /* global settings */
@ -415,5 +415,5 @@ const char *log_vty_category_string(struct log_info *info)
void log_init(const struct log_info *cat) void log_init(const struct log_info *cat)
{ {
tall_log_ctx = talloc_named_const(NULL, 1, "logging"); tall_log_ctx = talloc_named_const(NULL, 1, "logging");
log_info = cat; osmo_log_info = cat;
} }

View file

@ -33,7 +33,7 @@
#include <osmocom/vty/telnet_interface.h> #include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/logging.h> #include <osmocom/vty/logging.h>
extern const struct log_info *log_info; extern const struct log_info *osmo_log_info;
static void _vty_output(struct log_target *tgt, const char *line) static void _vty_output(struct log_target *tgt, const char *line)
{ {
@ -291,7 +291,7 @@ DEFUN(show_logging_vty,
vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE); vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
vty_print_logtarget(vty, log_info, conn->dbg); vty_print_logtarget(vty, osmo_log_info, conn->dbg);
return CMD_SUCCESS; return CMD_SUCCESS;
} }