libosmocore 1.13.1.1-afb4 Osmocom core library

logging.h
Go to the documentation of this file.
1#pragma once
2
7#include <stdio.h>
8#include <stdint.h>
9#include <stdarg.h>
10#include <stdbool.h>
11#include <osmocom/core/defs.h>
12#include <osmocom/core/linuxlist.h>
13
14 extern struct log_info *osmo_log_info;
15
16#ifndef DEBUG
17#define DEBUG
18#endif
19
20#ifdef LIBOSMOCORE_NO_LOGGING
21#undef DEBUG
22#endif
23
24#ifdef DEBUG
30#define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args)
31#define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args)
32#else
33#define DEBUGP(xss, fmt, args...)
34#define DEBUGPC(ss, fmt, args...)
35#endif
36
37
38 void osmo_vlogp(int subsys, int level, const char *file, int line,
39 int cont, const char *format, va_list ap);
40
41 void logp(int subsys, const char *file, int line, int cont, const char *format, ...) OSMO_DEPRECATED("Use DEBUGP* macros instead");
42
49#define LOGP(ss, level, fmt, args...) \
50 LOGPSRC(ss, level, NULL, 0, fmt, ## args)
51
58#ifndef LIBOSMOCORE_NO_LOGGING
59#define LOGPC(ss, level, fmt, args...) \
60 do { \
61 if (!osmo_log_info) { \
62 logp_stub(__FILE__, __LINE__, 1, fmt, ##args); \
63 break; \
64 } \
65 if (log_check_level(ss, level)) \
66 logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \
67 } while(0)
68#else
69#define LOGPC(ss, level, fmt, args...)
70#endif
71
84#define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \
85 LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args)
86
100#ifndef LIBOSMOCORE_NO_LOGGING
101#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \
102 do { \
103 if (!osmo_log_info) { \
104 if (caller_file) \
105 logp_stub(caller_file, caller_line, cont, fmt, ##args); \
106 else \
107 logp_stub(__FILE__, __LINE__, cont, fmt, ##args); \
108 break; \
109 } \
110 if (log_check_level(ss, level)) {\
111 if (caller_file) \
112 logp2(ss, level, caller_file, caller_line, cont, fmt, ##args); \
113 else \
114 logp2(ss, level, __FILE__, __LINE__, cont, fmt, ##args); \
115 }\
116 } while(0)
117#else
118#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...)
119#endif
120
122#define LOGL_DEBUG 1
123#define LOGL_INFO 3
124#define LOGL_NOTICE 5
125#define LOGL_ERROR 7
126#define LOGL_FATAL 8
128/* logging subsystems defined by the library itself */
129#define DLGLOBAL -1
130#define DLLAPD -2
131#define DLINP -3
132#define DLMUX -4
133#define DLMI -5
134#define DLMIB -6
135#define DLSMS -7
136#define DLCTRL -8
137#define DLGTP -9
138#define DLSTATS -10
139#define DLGSUP -11
140#define DLOAP -12
141#define DLSS7 -13
142#define DLSCCP -14
143#define DLSUA -15
144#define DLM3UA -16
145#define DLMGCP -17
146#define DLJIBUF -18
147#define DLRSPRO -19
148#define DLNS -20
149#define DLBSSGP -21
150#define DLNSDATA -22
151#define DLNSSIGNAL -23
152#define DLIUUP -24
153#define DLPFCP -25
154#define DLCSN1 -26
155#define DLM2PA -27
156#define DLM2UA -28
157#define DLIO -29
158#define DLTCAP -30
159#define OSMO_NUM_DLIB 30
161/* Colors that can be used in log_info_cat.color */
162#define OSMO_LOGCOLOR_NORMAL NULL
163#define OSMO_LOGCOLOR_RED "\033[1;31m"
164#define OSMO_LOGCOLOR_GREEN "\033[1;32m"
165#define OSMO_LOGCOLOR_YELLOW "\033[1;33m"
166#define OSMO_LOGCOLOR_BLUE "\033[1;34m"
167#define OSMO_LOGCOLOR_PURPLE "\033[1;35m"
168#define OSMO_LOGCOLOR_CYAN "\033[1;36m"
169#define OSMO_LOGCOLOR_DARKRED "\033[31m"
170#define OSMO_LOGCOLOR_DARKGREEN "\033[32m"
171#define OSMO_LOGCOLOR_DARKYELLOW "\033[33m"
172#define OSMO_LOGCOLOR_DARKBLUE "\033[34m"
173#define OSMO_LOGCOLOR_DARKPURPLE "\033[35m"
174#define OSMO_LOGCOLOR_DARKCYAN "\033[36m"
175#define OSMO_LOGCOLOR_DARKGREY "\033[1;30m"
176#define OSMO_LOGCOLOR_GREY "\033[37m"
177#define OSMO_LOGCOLOR_BRIGHTWHITE "\033[1;37m"
178#define OSMO_LOGCOLOR_END "\033[0;m"
179
181 struct log_category {
182 uint8_t loglevel;
183 uint8_t enabled;
184};
185
187 struct log_info_cat {
188 const char *name;
189 const char *color;
190 const char *description;
191 uint8_t loglevel;
192 uint8_t enabled;
193};
194
197 enum log_ctx_index {
198 LOG_CTX_GB_NSVC,
199 LOG_CTX_GB_BVC,
200 LOG_CTX_BSC_SUBSCR,
201 LOG_CTX_VLR_SUBSCR,
202 LOG_CTX_L1_SAPI,
203 LOG_CTX_GB_NSE,
204 _LOG_CTX_COUNT
205};
206
210 enum log_filter_index {
211 LOG_FLT_ALL,
212 LOG_FLT_GB_NSVC,
213 LOG_FLT_GB_BVC,
214 LOG_FLT_BSC_SUBSCR,
215 LOG_FLT_VLR_SUBSCR,
216 LOG_FLT_L1_SAPI,
217 LOG_FLT_GB_NSE,
218 _LOG_FLT_COUNT
219};
220
222#define LOG_MAX_CTX _LOG_CTX_COUNT
224#define LOG_MAX_FILTERS _LOG_FLT_COUNT
225
227 struct log_context {
228 void *ctx[LOG_MAX_CTX+1] OSMO_DEPRECATED_OUTSIDE("Accessing struct log_context members directly is deprecated");
229};
230
232#define LOG_FILTER_ALL (1<<LOG_FLT_ALL)
234#define GPRS_CTX_NSVC LOG_CTX_GB_NSVC
236#define GPRS_CTX_BVC LOG_CTX_GB_BVC
240 struct log_target;
241
243 typedef int log_filter(const struct log_context *ctx,
244 struct log_target *target);
245
246 struct log_info;
247 struct vty;
248 struct gsmtap_inst;
249
250 typedef void log_print_filters(struct vty *vty,
251 const struct log_info *info,
252 const struct log_target *tgt);
253
254 typedef void log_save_filters(struct vty *vty,
255 const struct log_info *info,
256 const struct log_target *tgt);
257
259 struct log_info {
260 /* filter callback function */
261 log_filter *filter_fn;
262
264 const struct log_info_cat *cat;
266 unsigned int num_cat;
268 unsigned int num_cat_user;
269
271 log_save_filters *save_fn;
273 log_print_filters *print_fn;
274};
275
277 enum log_target_type {
278 LOG_TGT_TYPE_VTY,
279 LOG_TGT_TYPE_SYSLOG,
280 LOG_TGT_TYPE_FILE,
281 LOG_TGT_TYPE_STDERR,
282 LOG_TGT_TYPE_STRRB,
283 LOG_TGT_TYPE_GSMTAP,
284 LOG_TGT_TYPE_SYSTEMD,
285 LOG_TGT_TYPE_EMSCRIPTEN,
286};
287
289 enum log_filename_type {
290 LOG_FILENAME_NONE,
291 LOG_FILENAME_PATH,
292 LOG_FILENAME_BASENAME,
293};
294
296 enum log_filename_pos {
297 LOG_FILENAME_POS_HEADER_END,
298 LOG_FILENAME_POS_LINE_END,
299};
300
302#define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET \
303 OSMO_DEPRECATED_OUTSIDE("Accessing struct log_target members directly is deprecated")
304 struct log_target {
305 struct llist_head entry;
308 int filter_map OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET;
310 void *filter_data[LOG_MAX_FILTERS+1] OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET;
311
313 struct log_category *categories;
314
316 uint8_t loglevel;
318 unsigned int use_color:1;
320 unsigned int print_timestamp:1;
322 unsigned int print_tid:1;
324 unsigned int print_filename:1;
326 unsigned int print_category:1;
328 unsigned int print_ext_timestamp:1;
329
331 enum log_target_type type;
332
333 union {
334 struct {
335 /* direct, blocking output via stdio */
336 FILE *out;
337 const char *fname;
338 /* indirect output via write_queue and osmo_select_main() */
339 struct osmo_wqueue *wqueue;
340 } tgt_file;
341
342 struct {
343 int priority;
344 int facility;
345 } tgt_syslog;
346
347 struct {
348 void *vty;
349 } tgt_vty;
350
351 struct {
352 void *rb;
353 } tgt_rb;
354
355 struct {
356 struct gsmtap_inst *gsmtap_inst;
357 const char *ident;
358 const char *hostname;
359 } tgt_gsmtap;
360
361 struct {
362 bool raw;
363 } sd_journal;
364 };
365
372 void (*output)(struct log_target *target, unsigned int level,
373 const char *string);
374
387 void (*raw_output)(struct log_target *target, int subsys,
388 unsigned int level, const char *file, int line,
389 int cont, const char *format, va_list ap);
390
391 /* Should the log level be printed? */
392 bool print_level;
393 /* Should we print the subsys in hex like '<000b>'? */
394 bool print_category_hex;
395 /* Should we print the source file and line, and in which way? */
396 enum log_filename_type print_filename2;
397 /* Where on a log line to put the source file info. */
398 enum log_filename_pos print_filename_pos;
399};
400
401/* use the above macros */
402 void logp2(int subsys, unsigned int level, const char *file,
403 int line, int cont, const char *format, ...)
404 __attribute__ ((format (printf, 6, 7)));
405 void logp_stub(const char *file, int line, int cont, const char *format, ...);
406 int log_init(const struct log_info *inf, void *talloc_ctx);
407 void log_fini(void);
408 int log_check_level(int subsys, unsigned int level);
409
410/* context management */
411 void log_reset_context(void);
412 int log_set_context(uint8_t ctx_nr, void *value);
413 void *log_get_context(const struct log_context *ctx, uint8_t ctx_nr);
414
415/* filter on the targets */
416 void log_set_all_filter(struct log_target *target, int);
417 bool log_get_filter(const struct log_target *target, int log_filter_index);
418 int log_set_filter(struct log_target *target, int log_filter_index, bool enable);
419 void *log_get_filter_data(const struct log_target *target, int log_filter_index);
420 int log_set_filter_data(struct log_target *target, int log_filter_index, void *data);
421
422 int log_cache_enable(void);
423 void log_cache_update(int mapped_subsys, uint8_t enabled, uint8_t level);
424 void log_set_use_color(struct log_target *target, int);
425 void log_set_print_extended_timestamp(struct log_target *target, int);
426 void log_set_print_timestamp(struct log_target *target, int);
427 void log_set_print_tid(struct log_target *target, int);
428 void log_set_print_filename(struct log_target *target, int) OSMO_DEPRECATED("Use log_set_print_filename2() instead");
429 void log_set_print_filename2(struct log_target *target, enum log_filename_type lft);
430 void log_set_print_filename_pos(struct log_target *target, enum log_filename_pos pos);
431 void log_set_print_category(struct log_target *target, int);
432 void log_set_print_category_hex(struct log_target *target, int);
433 void log_set_print_level(struct log_target *target, int);
434 void log_set_log_level(struct log_target *target, int log_level);
435 void log_parse_category_mask(struct log_target *target, const char* mask);
436const char* log_category_name(int subsys);
437 int log_parse_level(const char *lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
438const char *log_level_str(unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
439 int log_parse_category(const char *category);
440 void log_set_category_filter(struct log_target *target, int category,
441 int enable, int level);
442
443/* management of the targets */
444struct log_target *log_target_create(void);
445 void log_target_destroy(struct log_target *target);
446struct log_target *log_target_create_stderr(void);
447struct log_target *log_target_create_file(const char *fname);
448struct log_target *log_target_create_syslog(const char *ident, int option,
449 int facility);
450struct log_target *log_target_create_gsmtap(const char *host, uint16_t port,
451 const char *ident,
452 bool ofd_wq_mode,
453 bool add_sink);
454struct log_target *log_target_create_systemd(bool raw);
455struct log_target *log_target_create_emscripten(void);
456 void log_target_systemd_set_raw(struct log_target *target, bool raw);
457 int log_target_file_reopen(struct log_target *tgt);
458 int log_target_file_switch_to_stream(struct log_target *tgt);
459 int log_target_file_switch_to_wqueue(struct log_target *tgt);
460 int log_target_file_get_nonblock(const struct log_target *target);
461 int log_target_file_set_nonblock(struct log_target *target, int on);
462 int log_targets_reopen(void);
463
464 void log_add_target(struct log_target *target);
465 void log_del_target(struct log_target *target);
466
467struct log_target *log_target_find(enum log_target_type type, const char *fname);
468
469 void log_enable_multithread(void);
470
471 void log_tgt_mutex_lock_impl(void);
472 void log_tgt_mutex_unlock_impl(void);
473#define LOG_MTX_DEBUG 0
474#if LOG_MTX_DEBUG
475 #include <pthread.h>
476 #define log_tgt_mutex_lock() do { fprintf(stderr, "[%lu] %s:%d [%s] lock\n", pthread_self(), __FILE__, __LINE__, __func__); log_tgt_mutex_lock_impl(); } while (0)
477 #define log_tgt_mutex_unlock() do { fprintf(stderr, "[%lu] %s:%d [%s] unlock\n", pthread_self(), __FILE__, __LINE__, __func__); log_tgt_mutex_unlock_impl(); } while (0)
478#else
479 #define log_tgt_mutex_lock() log_tgt_mutex_lock_impl()
480 #define log_tgt_mutex_unlock() log_tgt_mutex_unlock_impl()
481#endif
482
defs.h
General definitions that are meant to be included from header files.
type
enum osmo_sub_auth_type type
file
write Write running configuration to or terminal n Write configuration to the file(same as write file)\n") ALIAS(config_write_file
__attribute__
enum gsm0808_assignment_requirement __attribute__
Definition: log2.h:61
data
uint8_t data[0]
log_set_filter_data
int log_set_filter_data(struct log_target *target, int log_filter_index, void *data)
Set data associated to a log filter.
Definition: logging.c:983
log_filter_index
log_filter_index
Indexes to indicate objects that should be logged.
Definition: logging.h:210
log_target_create_stderr
struct log_target * log_target_create_stderr(void)
Create the STDERR log target.
Definition: logging_file.c:402
log_ctx_index
log_ctx_index
Indexes to indicate the object currently acted upon.
Definition: logging.h:197
log_target_file_switch_to_wqueue
int log_target_file_switch_to_wqueue(struct log_target *tgt)
switch from blocking + buffered file output to non-blocking write-queue based output.
Definition: logging_file.c:335
log_target_create_file
struct log_target * log_target_create_file(const char *fname)
Create a new file-based log target using a stream.
Definition: logging_file.c:375
log_set_filter
int log_set_filter(struct log_target *target, int log_filter_index, bool enable)
Enable/disable a log filter.
Definition: logging.c:942
log_tgt_mutex_unlock_impl
void log_tgt_mutex_unlock_impl(void)
Release the osmo_log_tgt_mutex.
Definition: logging.c:201
log_target_type
log_target_type
Type of logging target.
Definition: logging.h:277
log_set_print_category
void log_set_print_category(struct log_target *target, int)
Enable or disable printing of the category name.
Definition: logging.c:1080
log_tgt_mutex_lock_impl
void log_tgt_mutex_lock_impl(void)
Acquire the osmo_log_tgt_mutex.
Definition: logging.c:185
log_set_use_color
void log_set_use_color(struct log_target *target, int)
Enable or disable the use of colored output.
Definition: logging.c:1001
log_target_file_reopen
int log_target_file_reopen(struct log_target *tgt)
close and re-open a log file (for log file rotation)
Definition: logging_file.c:52
log_set_print_tid
void log_set_print_tid(struct log_target *target, int)
Enable or disable printing of timestamps while logging.
Definition: logging.c:1032
log_set_print_category_hex
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:1089
log_parse_level
int log_parse_level(const char *lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
Parse a human-readable log level into a numeric value.
Definition: logging.c:417
log_set_print_level
void log_set_print_level(struct log_target *target, int)
Enable or disable printing of the log level name.
Definition: logging.c:1100
log_set_all_filter
void log_set_all_filter(struct log_target *target, int)
Enable/disable the LOG_FLT_ALL log filter.
Definition: logging.c:928
log_target_file_set_nonblock
int log_target_file_set_nonblock(struct log_target *target, int on)
Set the log target fd as non-blocking (see sockopt O_NONBLOCK).
Definition: logging_file.c:102
log_parse_category_mask
void log_parse_category_mask(struct log_target *target, const char *mask)
parse the log category mask
Definition: logging.c:458
log_set_context
int log_set_context(uint8_t ctx_nr, void *value)
Set the logging context.
Definition: logging.c:875
log_target_create_gsmtap
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:137
log_get_filter
bool log_get_filter(const struct log_target *target, int log_filter_index)
Query whether a log filter is enabled or disabled.
Definition: logging.c:907
log_set_print_filename_pos
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:1069
log_print_filters
void log_print_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging.h:250
osmo_vlogp
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:741
log_set_log_level
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:1109
log_save_filters
void log_save_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging.h:254
LOG_MAX_FILTERS
#define LOG_MAX_FILTERS
Maximum number of logging filters.
Definition: logging.h:224
log_target_destroy
void log_target_destroy(struct log_target *target)
Unregister, close and delete a log target.
Definition: logging.c:1223
log_filename_pos
log_filename_pos
Where on a log line source file and line should be logged.
Definition: logging.h:296
log_check_level
int log_check_level(int subsys, unsigned int level)
Check whether a log entry will be generated.
Definition: logging.c:1386
log_level_str
const char * log_level_str(unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
convert a numeric log level into human-readable string
Definition: logging.c:426
log_category_name
const char * log_category_name(int subsys)
Definition: logging.c:535
osmo_log_info
struct log_info * osmo_log_info
Definition: logging.c:81
log_set_print_filename2
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:1058
log_target_create_systemd
struct log_target * log_target_create_systemd(bool raw)
Create a new logging target for systemd journal logging.
Definition: logging_systemd.c:87
log_filter
int log_filter(const struct log_context *ctx, struct log_target *target)
Log filter function.
Definition: logging.h:243
log_target_create
struct log_target * log_target_create(void)
Create a new log target skeleton.
Definition: logging.c:1143
log_get_filter_data
void * log_get_filter_data(const struct log_target *target, int log_filter_index)
Obtain data associated to a log filter.
Definition: logging.c:964
log_set_print_extended_timestamp
void log_set_print_extended_timestamp(struct log_target *target, int)
Enable or disable printing of extended timestamps while logging.
Definition: logging.c:1023
log_set_category_filter
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:1123
log_filename_type
log_filename_type
Whether/how to log the source filename (and line number).
Definition: logging.h:289
log_get_context
void * log_get_context(const struct log_context *ctx, uint8_t ctx_nr)
Get the logging context.
Definition: logging.c:895
logp
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:796
log_fini
void log_fini(void)
Definition: logging.c:1367
DEBUGP
#define DEBUGP(ss, fmt, args...)
Log a debug message through the Osmocom logging framework.
Definition: logging.h:30
LOG_MAX_CTX
#define LOG_MAX_CTX
Maximum number of logging contexts.
Definition: logging.h:222
log_target_create_emscripten
struct log_target * log_target_create_emscripten(void)
Create a new logging target for JS callback logging (uses on_log)
Definition: logging_emscripten.c:66
log_init
int log_init(const struct log_info *inf, void *talloc_ctx)
Initialize the Osmocom logging core.
Definition: logging.c:1308
logp_stub
void void logp_stub(const char *file, int line, int cont, const char *format,...)
Definition: logging.c:826
log_parse_category
int log_parse_category(const char *category)
parse a human-readable log category into numeric form
Definition: logging.c:435
log_cache_update
void log_cache_update(int mapped_subsys, uint8_t enabled, uint8_t level)
Updates single cache entry, caller must hold osmo_log_tgt_mutex.
Definition: logging.c:127
log_target_find
struct log_target * log_target_find(enum log_target_type type, const char *fname)
Find a registered log target.
Definition: logging.c:1198
log_enable_multithread
void log_enable_multithread(void)
Enable multithread support (mutex) in libosmocore logging system.
Definition: logging.c:175
log_target_file_get_nonblock
int log_target_file_get_nonblock(const struct log_target *target)
Find whether the log target fd is configured as non-blocking (see sockopt O_NONBLOCK).
Definition: logging_file.c:133
log_target_file_switch_to_stream
int log_target_file_switch_to_stream(struct log_target *tgt)
switch from non-blocking/write-queue to blocking + buffered stream output
Definition: logging_file.c:246
log_targets_reopen
int log_targets_reopen(void)
close and re-open all log files (for log file rotation)
Definition: logging.c:1253
log_set_print_filename
void log_set_print_filename(struct log_target *target, int) OSMO_DEPRECATED("Use log_set_print_filename2() instead")
Use log_set_print_filename2() instead.
Definition: logging.c:1046
log_cache_enable
int log_cache_enable(void)
Enable the log level lookup cache to bypass string formatting and other code for log statements which...
Definition: logging.c:1279
logp2
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:813
log_set_print_timestamp
void log_set_print_timestamp(struct log_target *target, int)
Enable or disable printing of timestamps while logging.
Definition: logging.c:1010
log_target_create_syslog
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:67
log_add_target
void log_add_target(struct log_target *target)
Register a new log target with the logging core.
Definition: logging.c:839
log_del_target
void log_del_target(struct log_target *target)
Unregister a log target from the logging core.
Definition: logging.c:850
log_reset_context
void log_reset_context(void)
Reset (clear) the logging context.
Definition: logging.c:859
log_target_systemd_set_raw
void log_target_systemd_set_raw(struct log_target *target, bool raw)
Change meta information handling of an existing logging target.
Definition: logging_systemd.c:106
LOG_FLT_VLR_SUBSCR
@ LOG_FLT_VLR_SUBSCR
Definition: logging.h:215
_LOG_FLT_COUNT
@ _LOG_FLT_COUNT
Definition: logging.h:218
LOG_FLT_ALL
@ LOG_FLT_ALL
Definition: logging.h:211
LOG_FLT_GB_NSE
@ LOG_FLT_GB_NSE
Definition: logging.h:217
LOG_FLT_BSC_SUBSCR
@ LOG_FLT_BSC_SUBSCR
Definition: logging.h:214
LOG_FLT_GB_NSVC
@ LOG_FLT_GB_NSVC
Definition: logging.h:212
LOG_FLT_L1_SAPI
@ LOG_FLT_L1_SAPI
Definition: logging.h:216
LOG_FLT_GB_BVC
@ LOG_FLT_GB_BVC
Definition: logging.h:213
LOG_CTX_GB_NSE
@ LOG_CTX_GB_NSE
Definition: logging.h:203
LOG_CTX_BSC_SUBSCR
@ LOG_CTX_BSC_SUBSCR
Definition: logging.h:200
LOG_CTX_GB_BVC
@ LOG_CTX_GB_BVC
Definition: logging.h:199
_LOG_CTX_COUNT
@ _LOG_CTX_COUNT
Definition: logging.h:204
LOG_CTX_L1_SAPI
@ LOG_CTX_L1_SAPI
Definition: logging.h:202
LOG_CTX_GB_NSVC
@ LOG_CTX_GB_NSVC
Definition: logging.h:198
LOG_CTX_VLR_SUBSCR
@ LOG_CTX_VLR_SUBSCR
Definition: logging.h:201
LOG_TGT_TYPE_VTY
@ LOG_TGT_TYPE_VTY
VTY logging.
Definition: logging.h:278
LOG_TGT_TYPE_EMSCRIPTEN
@ LOG_TGT_TYPE_EMSCRIPTEN
Emscripten logging using JS callback.
Definition: logging.h:285
LOG_TGT_TYPE_FILE
@ LOG_TGT_TYPE_FILE
text file logging
Definition: logging.h:280
LOG_TGT_TYPE_SYSLOG
@ LOG_TGT_TYPE_SYSLOG
syslog based logging
Definition: logging.h:279
LOG_TGT_TYPE_STRRB
@ LOG_TGT_TYPE_STRRB
osmo_strrb-backed logging
Definition: logging.h:282
LOG_TGT_TYPE_STDERR
@ LOG_TGT_TYPE_STDERR
stderr logging
Definition: logging.h:281
LOG_TGT_TYPE_GSMTAP
@ LOG_TGT_TYPE_GSMTAP
GSMTAP network logging.
Definition: logging.h:283
LOG_TGT_TYPE_SYSTEMD
@ LOG_TGT_TYPE_SYSTEMD
systemd journal logging
Definition: logging.h:284
LOG_FILENAME_POS_LINE_END
@ LOG_FILENAME_POS_LINE_END
Definition: logging.h:298
LOG_FILENAME_POS_HEADER_END
@ LOG_FILENAME_POS_HEADER_END
Definition: logging.h:297
LOG_FILENAME_BASENAME
@ LOG_FILENAME_BASENAME
Definition: logging.h:292
LOG_FILENAME_NONE
@ LOG_FILENAME_NONE
Definition: logging.h:290
LOG_FILENAME_PATH
@ LOG_FILENAME_PATH
Definition: logging.h:291
OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
#define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
Definition: defs.h:48
OSMO_DEPRECATED
#define OSMO_DEPRECATED(text)
Set the deprecated attribute with a message.
Definition: defs.h:41
subsys
char subsys[16]
logging sub-system
Definition: gsmtap.h:9
level
uint8_t level
logging level
Definition: gsmtap.h:6
linuxlist.h
Simple doubly linked list implementation.
gsmtap_inst
one gsmtap instance
Definition: gsmtap_util.c:51
host
llist_head
(double) linked list header structure
Definition: linuxlist.h:46
log_category
Configuration of single log category / sub-system.
Definition: logging.h:181
log_category::enabled
uint8_t enabled
is logging enabled?
Definition: logging.h:183
log_category::loglevel
uint8_t loglevel
configured log-level
Definition: logging.h:182
log_context
Log context information, passed to filter.
Definition: logging.h:227
log_context::OSMO_DEPRECATED_OUTSIDE
void *ctx[LOG_MAX_CTX+1] OSMO_DEPRECATED_OUTSIDE("Accessing struct log_context members directly is deprecated")
log_info_cat
Information regarding one logging category.
Definition: logging.h:187
log_info_cat::enabled
uint8_t enabled
is this category enabled or not
Definition: logging.h:192
log_info_cat::name
const char * name
name of category
Definition: logging.h:188
log_info_cat::description
const char * description
description text
Definition: logging.h:190
log_info_cat::color
const char * color
color string for cateyory
Definition: logging.h:189
log_info_cat::loglevel
uint8_t loglevel
currently selected log-level
Definition: logging.h:191
log_info
Logging configuration, passed to log_init.
Definition: logging.h:259
log_info::num_cat
unsigned int num_cat
total number of categories
Definition: logging.h:266
log_info::print_fn
log_print_filters * print_fn
filter saving function
Definition: logging.h:273
log_info::save_fn
log_save_filters * save_fn
filter saving function
Definition: logging.h:271
log_info::filter_fn
log_filter * filter_fn
Definition: logging.h:261
log_info::cat
const struct log_info_cat * cat
per-category information
Definition: logging.h:264
log_info::num_cat_user
unsigned int num_cat_user
total number of user categories (not library)
Definition: logging.h:268
log_target
Definition: logging.h:304
log_target::print_category_hex
bool print_category_hex
Definition: logging.h:394
log_target::priority
int priority
Definition: logging.h:343
log_target::print_timestamp
unsigned int print_timestamp
should log messages be prefixed with a timestamp?
Definition: logging.h:320
log_target::vty
void * vty
Definition: logging.h:348
log_target::sd_journal
struct log_target::@8::@15 sd_journal
log_target::tgt_gsmtap
struct log_target::@8::@14 tgt_gsmtap
log_target::categories
struct log_category * categories
logging categories
Definition: logging.h:313
log_target::tgt_file
struct log_target::@8::@10 tgt_file
log_target::print_tid
unsigned int print_tid
should log messages be prefixed with the logger Thread ID?
Definition: logging.h:322
log_target::entry
struct llist_head entry
linked list
Definition: logging.h:305
log_target::wqueue
struct osmo_wqueue * wqueue
Definition: logging.h:339
log_target::print_filename2
enum log_filename_type print_filename2
Definition: logging.h:396
log_target::raw_output
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:387
log_target::facility
int facility
Definition: logging.h:344
log_target::print_filename_pos
enum log_filename_pos print_filename_pos
Definition: logging.h:398
log_target::print_filename
unsigned int print_filename
DEPRECATED: use print_filename2 instead.
Definition: logging.h:324
log_target::OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET
int filter_map OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET
Internal data for filtering.
Definition: logging.h:308
log_target::gsmtap_inst
struct gsmtap_inst * gsmtap_inst
Definition: logging.h:356
log_target::use_color
unsigned int use_color
should color be used when printing log messages?
Definition: logging.h:318
log_target::tgt_vty
struct log_target::@8::@12 tgt_vty
log_target::tgt_rb
struct log_target::@8::@13 tgt_rb
log_target::print_ext_timestamp
unsigned int print_ext_timestamp
should log messages be prefixed with an extended timestamp?
Definition: logging.h:328
log_target::rb
void * rb
Definition: logging.h:352
log_target::raw
bool raw
Definition: logging.h:362
log_target::fname
const char * fname
Definition: logging.h:337
log_target::print_category
unsigned int print_category
should log messages be prefixed with a category name?
Definition: logging.h:326
log_target::type
enum log_target_type type
the type of this log taget
Definition: logging.h:331
log_target::tgt_syslog
struct log_target::@8::@11 tgt_syslog
log_target::out
FILE * out
Definition: logging.h:336
log_target::print_level
bool print_level
Definition: logging.h:392
log_target::hostname
const char * hostname
Definition: logging.h:358
log_target::ident
const char * ident
Definition: logging.h:357
log_target::OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET
void *filter_data[LOG_MAX_FILTERS+1] OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET
Internal data for filtering.
Definition: logging.h:310
log_target::output
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:372
log_target::loglevel
uint8_t loglevel
global log level
Definition: logging.h:316
osmo_wqueue
write queue instance
Definition: write_queue.h:30
vty