diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-01-16 01:52:29 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2018-01-19 15:46:49 +0000 |
commit | bd7bd3947d4882bd7939e34d4565027c64524742 (patch) | |
tree | 71465644916d3f3675787f8aaac9e31fcb2e9374 /include | |
parent | 1ac277dcef694a2f849a6b5259cf5aa4488bebb9 (diff) |
logging: separate the '<000b>' subsys from filename logging
Add a separate flag and API to switch the category-in-hex output:
log_set_print_category_hex().
Add log_set_print_filename2() to modify only the print_filename flag. The old
log_set_print_filename() function still affects both flags. Explain the
rationale in the comment for log_set_print_filename().
There is no need to deprecate log_set_print_filename(); it might cause compiler
warnings and break strict builds unnecessarily.
Add VTY command 'logging print category-hex (0|1)'.
Since there is no VTY command to switch filename output, nothing needs to be
adjusted there (a command will be added in a subsequent patch).
Change-Id: Iba03a2b7915853c6dccaf6c393c31405320538b4
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/core/logging.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 1e809d0a..1e79dab3 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -220,6 +220,12 @@ enum log_target_type { LOG_TGT_TYPE_GSMTAP, /*!< GSMTAP network logging */ }; +/*! Whether/how to log the source filename (and line number). */ +enum log_filename_type { + LOG_FILENAME_NONE, + LOG_FILENAME_PATH, +}; + /*! structure representing a logging target */ struct log_target { struct llist_head entry; /*!< linked list */ @@ -238,7 +244,7 @@ struct log_target { unsigned int use_color:1; /*! should log messages be prefixed with a timestamp? */ unsigned int print_timestamp:1; - /*! should log messages be prefixed with a filename? */ + /*! DEPRECATED: use print_filename2 instead. */ unsigned int print_filename:1; /*! should log messages be prefixed with a category name? */ unsigned int print_category:1; @@ -301,6 +307,10 @@ struct log_target { /* Should the log level be printed? */ bool print_level; + /* Should we print the subsys in hex like '<000b>'? */ + bool print_category_hex; + /* Should we print the source file and line, and in which way? */ + enum log_filename_type print_filename2; }; /* use the above macros */ @@ -322,7 +332,9 @@ void log_set_use_color(struct log_target *target, int); void log_set_print_extended_timestamp(struct log_target *target, int); void log_set_print_timestamp(struct log_target *target, int); void log_set_print_filename(struct log_target *target, int); +void log_set_print_filename2(struct log_target *target, enum log_filename_type lft); void log_set_print_category(struct log_target *target, int); +void log_set_print_category_hex(struct log_target *target, int); void log_set_print_level(struct log_target *target, int); void log_set_log_level(struct log_target *target, int log_level); void log_parse_category_mask(struct log_target *target, const char* mask); |