17 #define LOG_MAX_FILTERS 8
27 #define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args)
28 #define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args)
30 #define DEBUGP(xss, fmt, args...)
31 #define DEBUGPC(ss, fmt, args...)
36 int cont,
const char *format, va_list ap);
46 #define LOGP(ss, level, fmt, args...) \
47 LOGPSRC(ss, level, NULL, 0, fmt, ## args)
55 #define LOGPC(ss, level, fmt, args...) \
57 if (log_check_level(ss, level)) \
58 logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \
73 #define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \
74 LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args)
89 #define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \
91 if (log_check_level(ss, level)) {\
93 logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
95 logp2(ss, level, __FILE__, __LINE__, cont, fmt, ##args); \
102 #define LOGL_NOTICE 5
126 #define OSMO_NUM_DLIB 19
129 struct log_category {
171 #define LOG_FILTER_ALL (1<<LOG_FLT_ALL)
173 #define GPRS_CTX_NSVC LOG_CTX_GB_NSVC
175 #define GPRS_CTX_BVC LOG_CTX_GB_BVC
314 unsigned int level,
const char *
file,
int line,
315 int cont,
const char *format, va_list ap);
329 int line,
int cont,
const char *format, ...)
355 const
char *
log_level_str(
unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
358 int enable,
int level);
void log_set_print_category_hex(struct log_target *target, int)
Enable or disable printing of the category number in hex ('<000b>').
Definition: logging.c:723
Definition: logging.h:234
Information regarding one logging category.
Definition: logging.h:135
int filter_map
Internal data for filtering.
Definition: logging.h:243
int log_parse_level(const char *lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
Parse a human-readable log level into a numeric value.
Definition: logging.c:198
#define OSMO_DEPRECATED(text)
Set the deprecated attribute with a message.
Definition: defs.h:41
int log_parse_category(const char *category)
parse a human-readable log category into numeric form
Definition: logging.c:216
const char * name
name of category
Definition: logging.h:136
VTY logging.
Definition: logging.h:217
struct osmo_gsm48_classmark __attribute__
Definition: conv_acc_generic.c:140
log_save_filters * save_fn
filter saving function
Definition: logging.h:210
Definition: logging.h:167
log_filename_type
Whether/how to log the source filename (and line number).
Definition: logging.h:226
enum log_target_type type
the type of this log taget
Definition: logging.h:264
bool print_level
Definition: logging.h:318
void * rb
Definition: logging.h:282
char subsys[16]
logging sub-system
Definition: gsmtap.h:122
void log_set_print_timestamp(struct log_target *target, int)
Enable or disable printing of timestamps while logging.
Definition: logging.c:653
const char * fname
Definition: logging.h:269
void logp(int subsys, const char *file, int line, int cont, const char *format,...) OSMO_DEPRECATED("Use DEBUGP* macros instead")
logging function used by DEBUGP() macro
Definition: logging.c:555
void log_set_print_filename(struct log_target *target, int)
Use log_set_print_filename2() instead.
Definition: logging.c:680
Configuration of single log category / sub-system.
Definition: logging.h:129
struct log_target::@8::@14 tgt_gsmtap
void log_set_print_extended_timestamp(struct log_target *target, int)
Enable or disable printing of extended timestamps while logging.
Definition: logging.c:666
log_ctx_index
Indexes to indicate the object currently acted upon.
Definition: logging.h:150
Definition: logging.h:152
#define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
Definition: defs.h:47
Definition: logging.h:228
struct log_target * log_target_create_gsmtap(const char *host, uint16_t port, const char *ident, bool ofd_wq_mode, bool add_sink)
Create a new logging target for GSMTAP logging.
Definition: logging_gsmtap.c:123
Definition: logging.h:164
uint8_t enabled
is this category enabled or not
Definition: logging.h:140
void log_set_print_filename2(struct log_target *target, enum log_filename_type lft)
Enable or disable printing of the filename while logging.
Definition: logging.c:692
void * ctx[LOG_MAX_CTX+1]
Definition: logging.h:145
log_filter_index
Indexes to indicate objects that should be logged.
Definition: logging.h:161
Definition: logging.h:162
int log_set_context(uint8_t ctx, void *value)
Set the logging context.
Definition: logging.c:614
syslog based logging
Definition: logging.h:218
struct log_target::@8::@13 tgt_rb
const char * ident
Definition: logging.h:287
Definition: logging.h:165
General definitions that are meant to be included from header files.
struct log_target * log_target_create_syslog(const char *ident, int option, int facility)
log_target_type
Type of logging target.
Definition: logging.h:216
void log_target_destroy(struct log_target *target)
Unregister, close and delete a log target.
Definition: logging.c:895
#define DEBUGP(ss, fmt, args...)
Log a debug message through the Osmocom logging framework.
Definition: logging.h:27
void * vty
Definition: logging.h:278
#define LOG_MAX_FILTERS
Maximum number of logging filters.
Definition: logging.h:17
write Write running configuration to or terminal n Write configuration to the file(same as write file)\n") ALIAS(config_write_file
struct llist_head osmo_log_target_list
struct log_target * log_target_find(int type, const char *fname)
Find a registered log target.
Definition: logging.c:870
one gsmtap instance
Definition: gsmtap_util.h:23
uint8_t enabled
is logging enabled?
Definition: logging.h:131
enum log_filename_type print_filename2
Definition: logging.h:322
int facility
Definition: logging.h:274
uint8_t level
logging level
Definition: gsmtap.h:119
unsigned int print_category
should log messages be prefixed with a category name?
Definition: logging.h:259
void log_add_target(struct log_target *target)
Register a new log target with the logging core.
Definition: logging.c:584
int log_filter(const struct log_context *ctx, struct log_target *target)
Log filter function.
Definition: logging.h:182
osmo_strrb-backed logging
Definition: logging.h:221
Definition: logging.h:166
int priority
Definition: logging.h:273
void(* raw_output)(struct log_target *target, int subsys, unsigned int level, const char *file, int line, int cont, const char *format, va_list ap)
alternative call-back function to which the logging framework passes the unfortmatted input arguments...
Definition: logging.h:313
text file logging
Definition: logging.h:219
Definition: logging.h:227
bool print_category_hex
Definition: logging.h:320
void log_del_target(struct log_target *target)
Unregister a log target from the logging core.
Definition: logging.c:592
FILE * out
Definition: logging.h:268
enum log_filename_pos print_filename_pos
Definition: logging.h:324
void log_set_all_filter(struct log_target *target, int)
Enable the LOG_FLT_ALL log filter.
Definition: logging.c:632
stderr logging
Definition: logging.h:220
void log_save_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging.h:193
struct gsmtap_inst * gsmtap_inst
Definition: logging.h:286
Simple doubly linked list implementation.
void log_print_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging.h:189
unsigned int print_filename
DEPRECATED: use print_filename2 instead.
Definition: logging.h:257
(double) linked list header structure
Definition: linuxlist.h:46
void log_set_use_color(struct log_target *target, int)
Enable or disable the use of colored output.
Definition: logging.c:644
const char * color
color string for cateyory
Definition: logging.h:137
Definition: logging.h:163
void log_set_print_category(struct log_target *target, int)
Enable or disable printing of the category name.
Definition: logging.c:714
log_filter * filter_fn
Definition: logging.h:200
Definition: logging.h:153
int log_target_file_reopen(struct log_target *tgt)
close and re-open a log file (for log file rotation)
Definition: logging.c:921
Definition: logging.h:154
void int log_init(const struct log_info *inf, void *talloc_ctx)
Initialize the Osmocom logging core.
Definition: logging.c:962
struct log_target * log_target_create_stderr(void)
Create the STDERR log target.
Definition: logging.c:820
const char * log_level_str(unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
convert a numeric log level into human-readable string
Definition: logging.c:207
struct log_category * categories
logging categories
Definition: logging.h:248
uint8_t loglevel
global log level
Definition: logging.h:251
Definition: logging.h:229
void log_set_category_filter(struct log_target *target, int category, int enable, int level)
Set a category filter on a given log target.
Definition: logging.c:754
GSMTAP network logging.
Definition: logging.h:222
void log_fini(void)
Definition: logging.c:1010
int log_check_level(int subsys, unsigned int level)
Check whether a log entry will be generated.
Definition: logging.c:1025
uint8_t loglevel
configured log-level
Definition: logging.h:130
void log_set_print_filename_pos(struct log_target *target, enum log_filename_pos pos)
Set the position where on a log line the source file info should be logged.
Definition: logging.c:703
Definition: logging.h:155
struct log_target * log_target_create_file(const char *fname)
Create a new file-based log target.
Definition: logging.c:844
log_filename_pos
Where on a log line source file and line should be logged.
Definition: logging.h:233
struct log_target::@8::@10 tgt_file
Logging configuration, passed to log_init.
Definition: logging.h:198
uint8_t type
see GSMTAP_TYPE_*
Definition: gsmtap.h:115
void log_parse_category_mask(struct log_target *target, const char *mask)
parse the log category mask
Definition: logging.c:239
unsigned int print_timestamp
should log messages be prefixed with a timestamp?
Definition: logging.h:255
Definition: logging.h:151
log_print_filters * print_fn
filter saving function
Definition: logging.h:212
unsigned int num_cat_user
total number of user categories (not library)
Definition: logging.h:207
const char * log_category_name(int subsys)
Definition: logging.c:312
Log context information, passed to filter.
Definition: logging.h:144
void(* output)(struct log_target *target, unsigned int level, const char *string)
call-back function to be called when the logging framework wants to log a fully formatted string ...
Definition: logging.h:298
const struct log_info_cat * cat
per-category information
Definition: logging.h:203
struct log_target::@8::@11 tgt_syslog
struct log_target::@8::@12 tgt_vty
unsigned int use_color
should color be used when printing log messages?
Definition: logging.h:253
unsigned int print_ext_timestamp
should log messages be prefixed with an extended timestamp?
Definition: logging.h:261
struct log_target * log_target_create(void)
Create a new log target skeleton.
Definition: logging.c:779
void log_set_print_level(struct log_target *target, int)
Enable or disable printing of the log level name.
Definition: logging.c:734
const char * hostname
Definition: logging.h:288
structure representing a logging target
Definition: logging.h:239
void osmo_vlogp(int subsys, int level, const char *file, int line, int cont, const char *format, va_list ap)
vararg version of logging function
Definition: logging.c:524
void log_set_log_level(struct log_target *target, int log_level)
Set the global log level for a given log target.
Definition: logging.c:743
void log_reset_context(void)
Reset (clear) the logging context.
Definition: logging.c:598
#define LOG_MAX_CTX
Maximum number of logging contexts.
Definition: logging.h:15
uint8_t loglevel
currently selected log-level
Definition: logging.h:139
unsigned int num_cat
total number of categories
Definition: logging.h:205
void * filter_data[LOG_MAX_FILTERS+1]
Internal data for filtering.
Definition: logging.h:245
void logp2(int subsys, unsigned int level, const char *file, int line, int cont, const char *format,...) __attribute__((format(printf
logging function used by LOGP() macro
Definition: logging.c:572
int log_targets_reopen(void)
close and re-open all log files (for log file rotation)
Definition: logging.c:936
Definition: logging.h:235
const char * description
description text
Definition: logging.h:138
struct llist_head entry
linked list
Definition: logging.h:240