Commit Graph

127 Commits

Author SHA1 Message Date
Harald Welte 433005c87c initial support for static userspace probes via systemtap
This adds a --enable-systemtap configure option, which will then
add static tracepoints to the generated libosmocore binary.

At this point, only two tracepoints are supported: log_start
and log_done.  They can be used to trace the amount of time
a libosmocore-using application spends in potentiall blocking calls to
log to stderr or to files.

Related: OS#4311
Change-Id: I7e1ab664241deb524c9582cbd1bec31af46c747e
2021-02-03 13:55:40 +00:00
Daniel Willmann 7dccf8ede5 logging: Remove duplicate color for DLSMS
Change-Id: Ia797efce36e0afff74de54374d568521ecedf486
2021-01-07 18:57:18 +00:00
Vadim Yanitskiy d82ba90825 logging: revert color of LGLOBAL category back to white
"\033[38;5;19m" is unreadable on terminals with dark background.

Change-Id: I8ed40522b07c2028de4986d1f976609510faa894
2020-12-17 17:50:18 +00:00
Harald Welte 4c0e1a1f4c logging: Assing different 8bit colors to built-in subsystems
The 16 ANSI colors we started to use for OpenBSC in 2008 were
sufficient for those few sub-systems that occurred in the BSC/NITB.

Over time, most sub-systems did not get colors anymore.  Let's
change that and assign more or less random colors from the 8bit
color palette.

Change-Id: Ia8c0f91a61fbca0441faf66b3f368f45f886187c
2020-12-09 22:56:07 +01:00
Harald Welte fde19ed579 logging: Introduce DLBSSGP logging constant
Historically, BSSGP uses a non-constant, user-configurable integer
varieable for the logging sub-system.  Let's replace this with a
statically-allocated library logging constant.

This is required if we want to use the subsystem number in e.g.
static initialized for osmo_fsm.log_subsys.

Change-Id: I506190aae9217c0956e4b5764d1a0c0772268e93
2020-12-09 22:50:01 +01:00
Harald Welte a8b1b2175c logging: Introduce MAX_LOG_SIZE for the magic number 4096
Change-Id: Ia9645098dffecd29242857de8f1aea6b9aca5918
2020-09-29 19:06:22 +02:00
Alexander Couzens 6a161497cf Gb: add a second NS implementation
Reimplement NS with FSM.

Change-Id: I3525beef205588dfab9d3880a34115f1a2676e48
2020-09-15 11:54:41 +00:00
Pau Espin 6407c822ae logging: Avoid printing OSMO_LOGCOLOR_END if no color was used
There's no point in printing that code if no color was used in first
place, and looks strange when using logging with color enabled but no
color assigned to the category printing lines.

Only affected unit test output by this fix is osmo-bts'x
tx_power_test.c, which has been fixed in osmo-bts.git Change-Id
I5aa95997c8df4ce5ba8271acae99c45f68b96e11.

Change-Id: Ie38cc639d7f4acd908f357e5bfb3ced07147583e
2020-09-14 08:45:01 +00:00
Vadim Yanitskiy b89114b3fa logging: fix memleak in log_target_create_file()
Change-Id: If16d8c6417698bbb5cf87716f9507c7256aeaecb
2020-09-09 05:00:15 +07:00
Vadim Yanitskiy 04f4271704 logging: fix log_target_destroy(): properly close syslog
Change-Id: I122445e8ee842b5f807d21a272520648660e7e65
2020-09-09 04:47:45 +07:00
Vadim Yanitskiy 744236b96e logging: refactor and simplify log_target_destroy()
Change-Id: Ic6b9906e6fd24de6af9c869348c100d9ef6a7df6
2020-09-09 04:42:22 +07:00
Philipp Maier dc02c066fd logging: do not allow multiple calls of log_init()
calling log_init() multiple times would lead into memory leaks. The
function should only be called once on startup of the process. Lets make
sure that it does not get called multiple times by accident.

Change-Id: Ibb300e4c9b04767581116ab530b2e6a9a195db08
2020-05-12 17:51:25 +02:00
Philipp Maier dcad1c55ba logging: use LOGL_NOTICE when no loglevel is set
when the API user of libosmocores logging infrastructure does not set a
pre-defined logging level in struct log_info_cat, the result would be an
invalid logging level. In order to avoid problems with that and to spare
all the additional .loglevel = LOGL_NOTICE (API users are advised to use
LOGL_NOTICE as default) lines in the user code lets check the logging
level on startup and set LOGL_NOTICE if there is no logging level set.

Change-Id: Ib9e180261505062505fc4605a98023910f76cde6
Related: OS#2577
2020-05-12 17:47:27 +02:00
Neels Hofmeyr c5b71752d5 fix DLSMS logging category color: '[1:38m' isn't actually defined
Instead it apparently renders as bright white, so just use that constant
instead.

Change-Id: Ic775b6e37ccf61dc71a540b41d6a16a8a9291dc2
2019-11-23 07:58:47 +00:00
Neels Hofmeyr f2644aee55 logging.h: define ansi color constants
It's hard to figure out what color logging categories have with those ANSI
color code strings. Instead, define these OSMO_LOGCOLOR_* constants.

Naming: commonly, the logging.h header has the "LOG" prefix in the name, but it
seems saner to include the OSMO_ prefix: it seems too likely that some
libosmocore user somewhere already has defined "LOGCOLOR_RED" somewhere.

Change-Id: I03b6b1f73ae7ee61d37ff921e071a3d0881d3e9a
2019-11-23 07:58:47 +00:00
Pau Espin d12f698dbb logging: Introduce mutex API to manage log_target in multi-thread envs
log_enable_multithread() enables use of locks inside the
implementation. Lock use is disabled by default, this way only
multi-thread processes need to enable it and suffer related
complexity/performance penalties.

Locks are required around osmo_log_target_list and items inside it,
since targets can be used, modified and deleted by different threads
concurrently (for instance, user writing "logging disable" in VTY while
another thread is willing to write into that target).

Multithread apps and libraries aiming at being used in multithread apps
should update their code to use the locks introduced here when
containing code iterating over osmo_log_target_list explictly or
implicitly by obtaining a log_target (eg. osmo_log_vty2tgt()).

Related: OS#4088
Change-Id: Id7711893b34263baacac6caf4d489467053131bb
2019-10-09 14:19:52 +02:00
Pau Espin cc794e993c logging: Use reentrant ctime_r instead of ctime
It was noticed that multithreaded processes like osmo-trx can crash upon
using ctime().

Related: OS#4055
Change-Id: I19ebf29a2f1fc855bb7d56766b338c7c3432dfd1
2019-06-13 19:35:11 +02:00
Pau Espin 3aef238980 logging: Check return error from time() call
Related: OS#4055
Change-Id: Ief155a76169426a677256e09d3e91751c4e2529f
2019-06-13 15:34:01 +00:00
Vadim Yanitskiy 73e66b3eef src/logging.c: fix syntax errors in Doxygen documentation
This change should fix the following warnings:

  logging.c:956: warning: unable to resolve reference to `talloc'
                 for \ref command
  logging.c:203: warning: argument 'in' of command @param is not
                 found in the argument list of
                 log_level_str(unsigned int lvl)
  logging.c:194: warning: argument 'in' of command @param is not
                 found in the argument list of
                 log_parse_level(const char *lvl)
  logging.c:708: warning: argument 'print_catname' of command
                 @param is not found in the argument list of
                 log_set_print_category(struct log_target *target,
                                        int print_category)
  logging.c:687: warning: argument 'print_filename' of command
                 @param is not found in the argument list of
                 log_set_print_filename2(struct log_target *target,
                                         enum log_filename_type lft)
  logging.c:729: warning: argument 'print_catname' of command
                 @param is not found in the argument list of
                 log_set_print_level(struct log_target *target,
                                     int print_level)
  logging.c:893: warning: argument 'in' of command @param is not
                 found in the argument list of
                 log_target_destroy(struct log_target *target)

Change-Id: I85f6c70216b7574b49b90bb1469869a47f721713
2019-03-27 08:56:21 +01:00
Max 450f5ac910 Enable remote SIM protocol log level
It's defined in logging.h for quite some time but is not actually
enabled alongside with other internal logging categories.

Change-Id: I0e7a2add6293a072752900608c8ba34cc3850f31
2019-02-14 19:19:57 +01:00
Max 72dfd43799 Allow log_init() with NULL log_info
Since we have library-internal categories we don't have to force
application to supply its own categories. This is especially useful for
testing code inside libosmocore which only use internal categories
anyway.

Change-Id: I42159780b57684bff225789f036f28a4b25fc7b8
2018-12-06 15:52:28 +01:00
Neels Hofmeyr 098038ab18 logging vty: write: check logging levels validity
Change-Id: If683b1272ad2d5b402b91c52c496aa7975bc6315
2018-09-13 15:46:55 +00:00
Neels Hofmeyr 7e0686c6b4 logging vty: deprecate the 'everything' keyword
The 'logging level all everything' has not had an effect for some time now. The
plan is to bring back its old functionality, but to keep it deprecated and
rather define a less confusing name.

* Deprecate 'everything'.
* Do not write 'everything' during 'write file' or 'show running-config', which
  we curiously still do until now.

BTW, the reason why we need to compose a complete list of categories for the
deprecated 'everything' command is explained in detail in the commit log for
I3b083f27e3d751ccec258880ae7676e9af959a63

Change-Id: Ib75fedb0572570a61bb34ee729a2af86cf5f16da
2018-09-13 15:46:55 +00:00
Neels Hofmeyr ba0762d6cb logging vty: rewrite 'logging level' vty cmd generation
Completely drop the implementations of log_vty_command_{str,description}().
These functions have been public API once, marked as deprecated since
c65c5b4ea0 (March 2017). I considered to keep
them, or reduce them to useless stubs, but it is quite silly, really. These
functions are completely and utterly useless outside of libosmocore. Any
program linking these deserves to fail.

Re-implement vty logging level command gen, in logging_vty.c. logging.c is
simply the wrong place for that.

Introduce logging_internal.h to share logging definitions to logging_vty.c
without publishing as API.

Introduce static gen_logging_level_cmd_strs() to compose a list of category
arguments with their descriptions for VTY commands. Use osmo_talloc_asprintf()
instead of the previous error prone and chaotic strlen() counting method.

Do not dynamically generate log level arguments, just keep static strings. We
are super unlikely to ever change the log levels we have.

No changes in logging_vty_test.vty: proves that there is no functional change.

All of this, besides introducing basic sanity, is cosmetic preparation to be
able to re-use the generic command generation code for arbitrary commands with
category or level args (for deprecated and new keywords).

Rationale: I want to hide 'all' and 'everything' from the VTY command
documentation, by means of deprecating. I first tried to simply define a
deprecated 'logging level CAT everything' command:

  logging level (all|rsl|rr|...) (debug|info|notice|error|fatal)
  logging level CAT everything                   # <- deprecated and hidden

But unfortunately, command matching doesn't work as intended when the CAT
argument reflects a valid category; I want it to invoke the deprecated function
as soon as the 'everything' keyword follows, but it stays stuck to the "valid"
command when the category argument matches an explicit keyword in that list,
and will throw an error on the following 'everything' keyword. I.e.:

  logging level rsl everything
  % Unknown command  # <-- leads to config file parse error

  logging level unknown_string everything
  % Ignoring deprecated 'everything'  # <-- works only for invalid categories

So I need to define 'everything' separately, again with a list of each valid
category instead of a generic CAT arg.

Change-Id: I3b083f27e3d751ccec258880ae7676e9af959a63
2018-09-13 15:46:55 +00:00
Neels Hofmeyr 77ae45d22f log: add 'last' option to 'logging print file'
Allow printing the source file information *after* the log information.

Add target->print_filename_pos, log_set_print_filename_pos() and enum
log_filename_pos, and the optional 'last' keyword to the 'logging print file'
vty command. (An enum in case we want to add other positions later.)

Rationale: on log lines, the logging context is usually printed first in the
logging text. Without the source file information, this logging context pretty
much aligns in an easily readable way. When adding the source file information,
each line's logging context info is shifted right by a pretty much random
amount and it is hard to spot recurring logging contexts.

One solution is to switch off source file info, of course, but that's not an
option when actively hacking on bugs and new features.

For example, it is unnecessarily hard to spot lchan FSM related log lines in
this osmo-bsc log snippet:

DRSL NOTICE mgw_endpoint_fsm.c:603 mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Freeing instance
DRSL NOTICE fsm.c:381 mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Deallocated
DMSC NOTICE mgw_endpoint_fsm.c:603 SUBSCR_CONN(conn0){CLEARING}: Received Event FORGET_MGW_ENDPOINT
DCHAN DEBUG lchan_rtp_fsm.c:741 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED
DCHAN DEBUG lchan_rtp_fsm.c:520 lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Freeing instance
DCHAN DEBUG fsm.c:381 lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Deallocated
DCHAN DEBUG lchan_rtp_fsm.c:520 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED
DCHAN DEBUG lchan_fsm.c:1232 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: state_chg to WAIT_RF_RELEASE_ACK
DRSL NOTICE handover_fsm.c:762 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Terminating (cause = OSMO_FSM_TERM_REGULAR)
DRSL NOTICE handover_fsm.c:762 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Freeing instance
DRSL NOTICE fsm.c:381 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Deallocated
DCHAN DEBUG lchan_fsm.c:1196 lchan(0-0-1-TCH_F-0){WAIT_RF_RELEASE_ACK}: state_chg to BORKEN
DCHAN DEBUG lchan_fsm.c:354 lchan(0-0-1-TCH_F-0){BORKEN}: (type=TCH_F) Clearing lchan state
DLMGCP DEBUG mgcp_client.c:741 Tx MGCP msg to MGCP GW: 'DLCX 3 2@mgw MGCP 1.0'
DLMGCP DEBUG mgcp_client.c:743 Sending msg to MGCP GW size: 66
DRLL NOTICE mgcp_client_fsm.c:422 MGCP_CONN(to-BTS){ST_DLCX_RESP}: Received Event EV_DLCX_RESP

Placing the source file info behind the log text makes it much easier to
follow, while the source file info is still available:

DRSL NOTICE mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Freeing instance (mgw_endpoint_fsm.c:603)
DRSL NOTICE mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Deallocated (fsm.c:381)
DMSC NOTICE SUBSCR_CONN(conn0){CLEARING}: Received Event FORGET_MGW_ENDPOINT (mgw_endpoint_fsm.c:603)
DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED (lchan_rtp_fsm.c:741)
DCHAN DEBUG lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Freeing instance (lchan_rtp_fsm.c:520)
DCHAN DEBUG lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Deallocated (fsm.c:381)
DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED (lchan_rtp_fsm.c:520)
DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: state_chg to WAIT_RF_RELEASE_ACK (lchan_fsm.c:1232)
DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Terminating (cause = OSMO_FSM_TERM_REGULAR) (handover_fsm.c:745)
DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Freeing instance (handover_fsm.c:745)
DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Deallocated (fsm.c:381)
DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RF_RELEASE_ACK}: state_chg to BORKEN (lchan_fsm.c:1196)
DCHAN DEBUG lchan(0-0-1-TCH_F-0){BORKEN}: (type=TCH_F) Clearing lchan state (lchan_fsm.c:354)
DLMGCP DEBUG Tx MGCP msg to MGCP GW: 'DLCX 3 12@mgw MGCP 1.0' (mgcp_client.c:741)
DLMGCP DEBUG Sending msg to MGCP GW size: 67 (mgcp_client.c:743)
DRLL NOTICE MGCP_CONN(to-BTS){ST_DLCX_RESP}: Received Event EV_DLCX_RESP (mgcp_client_fsm.c:422)

Implementation: for 'last', insert source file info only when an '\n' is found
at the end of the log line composition buffer, so that LOGP()...LOGPC()
constructs also print source file info only when a log line actually ends.

Change-Id: I393907b3c9e0cc1145e102328adad0a83ee13a9f
2018-08-27 20:52:04 +02:00
Pau Espin 9d4a36e060 logging.c: Fix whitespace typo
Change-Id: I943763e175dca6f3078923a494b052319b78574d
2018-07-26 11:55:51 +02:00
Pau Espin 53a1e49354 logging: log_vty_command_string: Fix undercount of buf alloc size
Change-Id: I7aca0ce3d2981001e8081f7cee0dea3e2aaf8f7c
2018-07-25 18:51:20 +00:00
Harald Welte 14c4c498b1 Fix embedded (arm-none-eabi) builds
Due to OS#3360, build testing for arm-none-eabi was unfortunately
skipped for a long time.  This is a number of fixes that make the
compile test pass again.

Related: OS#3360
Change-Id: I88e3c8e1a8786ca2a6a023b0d27c74be200a8588
2018-06-28 10:30:34 +02:00
Pau Espin 8fd85578bc core/logging.h: Add logging category for jitter buffer
Forthcoming jitter buffer code in libosmo-netif will make use of it.

Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
2018-02-27 21:11:27 +00:00
Neels Hofmeyr 0e2a94326e logging: allow to log only the basename of each source
In the C API, add another enum log_file_type value, and when set print only the
basename of the source file path.

Rationale: especially when not building directly in the source dir, the paths
to the source files can become rather long. Usually, just the basename of the
file is sufficient to identify the source line.

Change-Id: If3e4d5fb2066f8bf86e59c82d1752b1a843cf58e
2018-01-19 15:46:49 +00:00
Neels Hofmeyr bd7bd3947d 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
2018-01-19 15:46:49 +00:00
Neels Hofmeyr c4759885d7 cosmetic: logging: if color is disabled, don't print ""
If color output is disabled, skip the empty snprintf() to (not) clear the ANSI
color.

Also, no need to use a format string of "%s", just pass the string constant
directly.

That is a micro optimisation as well as clarification of the code.

Change-Id: Ie7cb06de160830d2f8ee5718246c0fe311f68d49
2018-01-17 23:16:16 +00:00
Neels Hofmeyr 5e518b5b4c fix -Werror build: logging.c: always use literal with snprintf
A recent commit added an snprintf that passes a pointer to a literal directly
to snprintf. Since passing pointers to printf formats is a vulnerability in
case user supplied data may be passed in the format, modern compilers warn
against that, which breaks our -Werror builds. Even though this is just a
pointer to a literal, it needs to be an actual literal to make compilers happy.

Use printf("%s", c) instead of printf(c).

Note that our current build slave's gcc does not enforce that yet, while newer
compilers do.

  logging.c:338:4: warning: format not a string literal and no format arguments [-Wformat-security]
       ret = snprintf(buf + offset, rem, c_subsys);

Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
2018-01-17 13:27:55 +01:00
Neels Hofmeyr e653472573 logging: color the log category according to level
When log_set_use_color() is enabled, color the log category string according to
the log level. The log line before and after the log category is printed in the
category's configured color.

ERROR and FATAL are red, NOTICE is yellow, INFO is green and DEBUG is blue.

The default behavior remains unchanged; If color is enabled, the category
string will now always be colored in the log level color, not the log category
color, and will stand out from the rest of the line.

Change-Id: I84f886ac880e9056a666bbb231ae06cbaaf65f44
2018-01-17 11:13:58 +00:00
Neels Hofmeyr f3fa3694f5 logging: color the log level
When log_set_use_color() is enabled, color the log level string according to
the log level. The log line before and after the log level is printed in the
category's color.

ERROR and FATAL are red, NOTICE is yellow, INFO is green and DEBUG is blue.

The default behavior remains unchanged.

Change-Id: If2e52ae9ab83e538e04321c338e3fdffb2c7f9d3
2018-01-17 11:13:58 +00:00
Neels Hofmeyr 886e548ab0 logging: add ability to log the log-level with API and vty
Log the log level string after the category name, if enabled.

The default behavior remains unchanged.

Change-Id: Ie6be365cfa6aeabdf115bff19bac198440c9adf1
2018-01-17 11:13:58 +00:00
Max c90f40a277 Allow multiple 'log gsmtap' sinks
Previously we've checked for existing log target with a given hostname
from vty code but it was ignored inside the check so only the very first
'log gsmtap' entry was enabled while the rest were silently ignored.

Change-Id: I8fd8bda9e07d403a54735da30addb742e56538a2
2018-01-12 14:06:02 +00:00
Max 68bf16ab6f log: print loginfo assertions source
Print which function has triggered assert_loginfo(). It's handy in
debugging logging-related issues in libosmocore.

Change-Id: I8418d0c431106f50aa8779cd89396f02373304ad
2018-01-12 13:57:49 +00:00
Harald Welte e08da97570 Fix/Update copyright notices; Add SPDX annotation
Let's fix some erroneous/accidential references to wrong license,
update copyright information where applicable and introduce a
SPDX-License-Identifier to all files.

Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-11-13 01:35:12 +09:00
Harald Welte f01b2383b1 [doc] src/logging.c: Fix Doxygen syntax to make logging.c show up in logging group
Change-Id: I56718e1eca1739a1b0a790f2f3a1b554899a93ab
2017-10-16 14:19:00 +02:00
Neels Hofmeyr a7ccf6158c add DLMGCP logging category for libosmo-mgcp
In the course of splitting up the openbsc.git repository, we will create
libosmo-mgcp and need a library logging category for that purpose.

Change-Id: I09c587e2d59472cbde852d467d457254746d9e67
2017-07-18 10:47:56 +00:00
Pau Espin 399a6f09ff Fix warnings: tolower() and similar require uchar
utils.c: In function 'osmo_str2lower':
utils.c:277:3: warning: array subscript has type 'char' [-Wchar-subscripts]
       out[i] = tolower(in[i]);

And according to man:
If c is neither an unsigned char value nor EOF, the behavior of these func‐
tions is undefined.

Change-Id: I3fed2ab6a4efba9f8a21fcf84a5b3a91e8df084f
2017-06-23 10:21:54 +02:00
Neels Hofmeyr 17518fe393 doxygen: unify use of \file across the board
Considering the various styles and implications found in the sources, edit
scores of files to follow the same API doc guidelines around the doxygen
grouping and the \file tag.

Many files now show a short description in the generated API doc that was so
far only available as C comment.

The guidelines and reasoning behind it is documented at
https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation

In some instances, remove file comments and add to the corresponding group
instead, to be shared among several files (e.g. bitvec).

Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
2017-06-23 00:18:23 +00:00
Neels Hofmeyr 87e4550585 doxygen: enable AUTOBRIEF, drop \brief
Especially for short descriptions, it is annoying to have to type \brief for
every single API doc.

Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes
the first sentence of an API doc as the brief description.

Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
2017-06-23 00:18:22 +00:00
Harald Welte 96e2a00d7a update/extend doxygen documentation
It's a pity that even with this patch we still are fare away from having
the whole API documented.  However, at least we have a more solid
foundation.  Updates not only extend the documentation, but also make
sure it is rendered properly in the doxygen HTML.

Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
2017-06-12 21:55:54 +00:00
Harald Welte b93ce5afec src/logging.c: Fix EMBEDDED build
We don't enable/build _file_output in EMBEDDED builds, so we shouldn'r
refer to that symbol.

Change-Id: I491aa8ee9d20a96cbb2814700475afe03eb99c9e
2017-05-15 13:01:01 +02:00
Max c65c5b4ea0 vty: cleanup logging functions
* remove unused parameter from logging_vty_add_cmds()
* mark log level descriptors static
* change internal static function int check_log_to_target() to more
  appropriate bool should_log_to_target()
* deprecate log_vty_command_*() from public API as it should only be
  used by logging_vty_add_cmds()

Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e
Related: OS#71
2017-05-09 09:11:05 +00:00
Harald Welte 059c40476c logging: Add log_info_cat for DLSS7/DLSCCP/DLSUA/DLM3UA
In Change-Id I61f452208088dc7097165deecef7c058ebb4bd4e we introduced
the #defines but didn't introduce the new log_info_cat information.

Change-Id: I218aa4cb1fc7640a75663be29bac672dfa8770f5
2017-04-03 22:20:49 +02:00
Harald Welte 18a7d81932 logging: fail gracefully if log_info() was not called
The logging code crashes if osmo_log_info is not set, which is typically
achieved by calling log_init().  Let's fail with a reasonable assert
and error message if the user forgets that.

Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2
2017-03-16 23:56:01 +01:00
Neels Hofmeyr 8b86cd76cf logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*
My recent logging patch was merged to master a bit too soon. Accomodate the
request for naming that matches the general "LOG" prefix instead of "LOGGING".

libosmocore will not be backwards-compatible with the few commits from
change-id I5c343630020f4b108099696fd96c2111614c8067 up to this one. This and
following commits are backwards compatible with those before that short window.

See also:
* openbsc change-id Ib2ec5e4884aa90f48051ee2f832af557aa525991
* osmo-pcu change-id I4db4a668f2be07f3d55f848d38d1b490d8a7a685

Change-Id: I424fe3f12ea620338902b2bb8230544bde3f1a93
2017-02-23 18:08:12 +01:00