From 2822296ddb22389c5b4e9b8fb6ef7c906ff99314 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 18 Feb 2011 20:37:04 +0100 Subject: LOGGING: configure logging from the vty We can now configure logging to (multiple) files, stderr and syslog from the vty command line in a persistent way (config file) --- include/osmocom/vty/command.h | 1 + include/osmocore/logging.h | 13 +++++++++++++ include/osmocore/utils.h | 3 +++ 3 files changed, 17 insertions(+) (limited to 'include') diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h index 69e9e772..caf04142 100644 --- a/include/osmocom/vty/command.h +++ b/include/osmocom/vty/command.h @@ -70,6 +70,7 @@ enum node_type { CONFIG_NODE, /* Config node. Default mode of config file. */ SERVICE_NODE, /* Service node. */ DEBUG_NODE, /* Debug node. */ + CFG_LOG_NODE, /* Configure the logging */ VTY_NODE, /* Vty node. */ diff --git a/include/osmocore/logging.h b/include/osmocore/logging.h index d4d632d8..a2c63e9a 100644 --- a/include/osmocore/logging.h +++ b/include/osmocore/logging.h @@ -69,6 +69,13 @@ struct log_info { unsigned int num_cat; }; +enum log_target_type { + LOG_TGT_TYPE_VTY, + LOG_TGT_TYPE_SYSLOG, + LOG_TGT_TYPE_FILE, + LOG_TGT_TYPE_STDERR, +}; + struct log_target { struct llist_head entry; @@ -80,6 +87,8 @@ struct log_target { int use_color:1; int print_timestamp:1; + enum log_target_type type; + union { struct { FILE *out; @@ -88,6 +97,7 @@ struct log_target { struct { int priority; + int facility; } tgt_syslog; struct { @@ -138,4 +148,7 @@ void log_del_target(struct log_target *target); const char *log_vty_category_string(struct log_info *info); const char *log_vty_level_string(struct log_info *info); +struct log_target *log_target_find(int type, const char *fname); +extern struct llist_head osmo_log_target_list; + #endif /* _OSMOCORE_LOGGING_H */ diff --git a/include/osmocore/utils.h b/include/osmocore/utils.h index 6fe1b388..0cdf03b8 100644 --- a/include/osmocore/utils.h +++ b/include/osmocore/utils.h @@ -24,4 +24,7 @@ char *ubit_dump(const uint8_t *bits, unsigned int len); #define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; +void osmo_str2lower(char *out, const char *in); +void osmo_str2upper(char *out, const char *in); + #endif -- cgit v1.2.3