19 #define LOG_MAX_FILTERS 8 29 #define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args) 30 #define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args) 32 #define DEBUGP(xss, fmt, args...) 33 #define DEBUGPC(ss, fmt, args...) 37 void osmo_vlogp(
int subsys,
int level,
const char *file,
int line,
38 int cont,
const char *format, va_list ap);
40 void logp(
int subsys,
const char *file,
int line,
int cont,
const char *format, ...)
OSMO_DEPRECATED("Use
DEBUGP* macros instead");
48 #define LOGP(ss, level, fmt, args...) \ 49 LOGPSRC(ss, level, NULL, 0, fmt, ## args) 57 #define LOGPC(ss, level, fmt, args...) \ 59 if (log_check_level(ss, level)) \ 60 logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \ 75 #define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \ 77 if (log_check_level(ss, level)) {\ 79 logp2(ss, level, caller_file, caller_line, 0, fmt, ##args); \ 81 logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ 92 #define LOG_FILTER_ALL 0x0001 107 #define OSMO_NUM_DLIB 12 110 struct log_category { 139 typedef void log_print_filters(
struct vty *vty,
143 typedef void log_save_filters(
struct vty *vty,
225 const char *hostname;
251 unsigned int level,
const char *file,
int line,
252 int cont,
const char *format, va_list ap);
256 void logp2(
int subsys,
unsigned int level,
const char *file,
257 int line,
int cont,
const char *format, ...)
258 __attribute__ ((format (printf, 6, 7)));
277 const
char* log_category_name(
int subsys);
282 int enable,
int level);
306 extern struct
llist_head osmo_log_target_list;
Information regarding one logging category.
Definition: logging.h:116
int filter_map
Internal data for filtering.
Definition: logging.h:180
void log_set_all_filter(struct log_target *target, int)
Enable the LOG_FILTER_ALL log filter.
Definition: logging.c:503
int log_parse_level(const char *lvl)
Parse a human-readable log level into a numeric value.
Definition: logging.c:160
#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:178
const char * name
Definition: logging.h:117
VTY logging.
Definition: logging.h:167
log_save_filters * save_fn
filter saving function
Definition: logging.h:160
void log_set_print_timestamp(struct log_target *target, int)
Enable or disable printing of timestamps while logging.
Definition: logging.c:524
enum log_target_type type
the type of this log taget
Definition: logging.h:201
Definition: logging.h:110
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:103
uint8_t enabled
Definition: logging.h:121
syslog based logging
Definition: logging.h:168
const char * log_level_str(unsigned int lvl)
convert a numeric log level into human-readable string
Definition: logging.c:169
General definitions that are meant to be included from header files.
log_target_type
Type of logging target.
Definition: logging.h:166
void log_target_destroy(struct log_target *target)
Unregister, close and delete a log target.
Definition: logging.c:708
void log_set_use_color(struct log_target *target, int)
Enable or disable the use of colored output.
Definition: logging.c:515
#define DEBUGP(ss, fmt, args...)
Log a debug message through the Osmocom logging framework.
Definition: logging.h:29
#define LOG_MAX_FILTERS
Maximum number of logging filters.
Definition: logging.h:19
one gsmtap instance
Definition: gsmtap_util.h:23
uint8_t enabled
Definition: logging.h:112
unsigned int print_category
should log messages be prefixed with a category name?
Definition: logging.h:196
void log_add_target(struct log_target *target)
Register a new log target with the logging core.
Definition: logging.c:455
int log_filter(const struct log_context *ctx, struct log_target *target)
Log filter function.
Definition: logging.h:132
osmo_strrb-backed logging
Definition: logging.h:171
text file logging
Definition: logging.h:169
void log_del_target(struct log_target *target)
Unregister a log target from the logging core.
Definition: logging.c:463
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:250
struct log_target * log_target_create_file(const char *fname)
Create a new file-based log target.
Definition: logging.c:664
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:426
stderr logging
Definition: logging.h:170
Simple doubly linked list implementation.
unsigned int print_filename
should log messages be prefixed with a filename?
Definition: logging.h:194
(double) linked list header structure
Definition: linuxlist.h:47
const char * color
Definition: logging.h:118
void log_set_print_filename(struct log_target *target, int)
Enable or disable printing of the filename while logging.
Definition: logging.c:546
const char * log_vty_command_string(const struct log_info *info)
Generates the logging command string for VTY.
Definition: logging.c:772
int log_set_context(uint8_t ctx, void *value)
Set the logging context.
Definition: logging.c:485
void log_set_print_category(struct log_target *target, int)
Enable or disable printing of the category name.
Definition: logging.c:557
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:235
struct log_category * categories
logging categories
Definition: logging.h:185
uint8_t loglevel
global log level
Definition: logging.h:188
struct log_target * log_target_create_stderr(void)
Create the STDERR log target.
Definition: logging.c:640
void log_parse_category_mask(struct log_target *target, const char *mask)
parse the log category mask
Definition: logging.c:199
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:577
GSMTAP network logging.
Definition: logging.h:172
int log_check_level(int subsys, unsigned int level)
Check whether a log entry will be generated.
Definition: logging.c:972
uint8_t loglevel
Definition: logging.h:111
void int log_init(const struct log_info *inf, void *talloc_ctx)
Initialize the Osmocom logging core.
Definition: logging.c:912
const char * log_vty_command_description(const struct log_info *info)
Generates the logging command description for VTY.
Definition: logging.c:850
Logging configuration, passed to log_init.
Definition: logging.h:148
unsigned int print_timestamp
should log messages be prefixed with a timestamp?
Definition: logging.h:192
log_print_filters * print_fn
filter saving function
Definition: logging.h:162
unsigned int num_cat_user
total number of user categories (not library)
Definition: logging.h:157
Log context information, passed to filter.
Definition: logging.h:125
struct log_target * log_target_create(void)
Create a new log target skeleton.
Definition: logging.c:602
const struct log_info_cat * cat
per-category information
Definition: logging.h:153
struct log_target * log_target_create_syslog(const char *ident, int option, int facility)
Create a new logging target for syslog logging.
Definition: logging_syslog.c:72
unsigned int use_color
should color be used when printing log messages?
Definition: logging.h:190
struct log_target * log_target_find(int type, const char *fname)
Find a registered log target.
Definition: logging.c:690
unsigned int print_ext_timestamp
should log messages be prefixed with an extended timestamp?
Definition: logging.h:198
int log_target_file_reopen(struct log_target *tgt)
close and re-open a log file (for log file rotation)
Definition: logging.c:734
structure representing a logging target
Definition: logging.h:176
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:395
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:566
void log_reset_context(void)
Reset (clear) the logging context.
Definition: logging.c:469
#define LOG_MAX_CTX
Maximum number of logging contexts.
Definition: logging.h:17
uint8_t loglevel
Definition: logging.h:120
unsigned int num_cat
total number of categories
Definition: logging.h:155
void * filter_data[LOG_MAX_FILTERS+1]
Internal data for filtering.
Definition: logging.h:182
int log_targets_reopen(void)
close and re-open all log files (for log file rotation)
Definition: logging.c:749
void log_set_print_extended_timestamp(struct log_target *target, int)
Enable or disable printing of extended timestamps while logging.
Definition: logging.c:537
const char * description
Definition: logging.h:119
struct llist_head entry
linked list
Definition: logging.h:177