| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Change-Id: I943763e175dca6f3078923a494b052319b78574d
|
|
|
|
| |
Change-Id: I7aca0ce3d2981001e8081f7cee0dea3e2aaf8f7c
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Forthcoming jitter buffer code in libosmo-netif will make use of it.
Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Log the log level string after the category name, if enabled.
The default behavior remains unchanged.
Change-Id: Ie6be365cfa6aeabdf115bff19bac198440c9adf1
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Print which function has triggered assert_loginfo(). It's handy in
debugging logging-related issues in libosmocore.
Change-Id: I8418d0c431106f50aa8779cd89396f02373304ad
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
group
Change-Id: I56718e1eca1739a1b0a790f2f3a1b554899a93ab
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
We don't enable/build _file_output in EMBEDDED builds, so we shouldn'r
refer to that symbol.
Change-Id: I491aa8ee9d20a96cbb2814700475afe03eb99c9e
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
| |
In Change-Id I61f452208088dc7097165deecef7c058ebb4bd4e we introduced
the #defines but didn't introduce the new log_info_cat information.
Change-Id: I218aa4cb1fc7640a75663be29bac672dfa8770f5
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is too easy for calling code to use the same filter and context indexes for
different filters and structs. For example, openbsc's IMSI filter and libgb's
GPRS_BVC filter both fall on index 1 even though there are plenty more indexes
to choose from. To alleviate this, have one central definition here, sort of
like ports.h does for VTY and CTRL port numbers.
Add static asserts to make sure the indexes fit in the available array and bit
mask space.
Calling code like openbsc.git and osmo-pcu need adjustments and/or should move
to using these enum values instead of their local definitions.
Taking this opportunity to also prepare for a split of struct gsm_subscriber in
openbsc into bsc_subsciber and vlr_subscriber with appropriate separate filter
index constants for both subscriber types.
Include previous LOG_FILTER_ALL in the LOGGING_FILTER_* enum, and replace its
use by (1 << LOGGING_FILTER_ALL).
Change-Id: I5c343630020f4b108099696fd96c2111614c8067
|
|
|
|
|
|
|
| |
We don't have file-based I/O nor ethernet devices with mac addresses
when building for OsmocomBB.
Change-Id: I01a9e6d8dbe885dbeac2769b84931a4d44f7a3a5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In log_set_category_filter(), passing a negative index lead to memory
corruption. Particularly dangerous since the internal logging categories have
negative values.
Fix: apply map_subsys() to interpret negative values as internal logging
categories.
As a side effect, out-of-bounds logging categories will be mapped to DLGLOBAL
instead of being dropped.
Fix the expectations in logging_test to match the fixed bug.
While at it also guard against a NULL logging target.
Change-Id: Ib0725b22bc39498c6b3970a61eb3339cf56d19f1
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To check category bounds, rather use num_cat_user, to redirect all semantically
unknown categories to DLGLOBAL.
Adjust logging_test expectations accordingly: "(d)" is now also shown.
Note: subsys is and needs to be signed, while num_cat* are unsigned. Thus for a
negative subsys, 'subsys >= num_cat_user' practically always yields true. Pay
close attention to signedness and check upper bound only for positive values.
Change-Id: I4a952b759f30d90fbfb81fedcfc56a8092ea18c1
|
|
|
|
|
|
|
|
|
|
| |
In map_subsys(), fix the '>' condition to '>=' for array bounds checking.
Also make the bounds checking more strict: after both invocations of
subsys_lib2index(), re-check validity of the array index. If the final index is
still wrong, which should never happen, exit by assertion.
Change-Id: I7ca1a1d47724e40350f1c4dfebe90bad01c965f9
|
|
|
|
|
|
|
|
|
|
|
| |
For out-of-bounds logging categories, redirect to the proper DLGLOBAL array
index instead of returning -1.
Adjust test expectation which shows that the bugs tested for are fixed.
Note: there are separate bounds checking problems, left for another patch.
Change-Id: I6ea9a59e005a22e0305454291714fdb9531c346b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the process, also:
* Change the license from AGPLv3 to GPLv2-or-later;
* correct spelling of 'sysmocom' to lowercase;
* add '2016' to the copyright;
* rename to osmo_*;
* add API docs;
* add logging category DLOAP: define id and add to internal_cat;
* redirect all oap.c logging to DLOAP.
A unit test will follow in a subsequent patch, since it needs a minor tweak for
decoding of boolean values.
The related openbsc change-id is I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf.
Tweaked-by: Neels Hofmeyr
Change-Id: If5099e60681a215e798b6675f21813f26769c253
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All DL* categories are typically negative, but DLGSUP isn't, and it's also not
in libosmocore's internal_cat array.
See: 3b6fb0880c3ab1e23a3d7d738d073b00c2a794c2
This means that a program using DLGSUP has to include DLGSUP in its own logging
cat array (typically not needed for DL* categories), which means for osmo-nitb
that DLGSUP (11) replaces DMGCP (also 11), and DMGCP becomes unusable.
Fix this: make DLGSUP -11 and include in internal_cat.
In gsup_test.c, no longer add DLGSUP to the logging categories array.
External follow-ups are otherwise needed only in osmo-hlr.git and some pending
patches for openbsc (Id3938267fa062e1a997d3704cd678874306f86ee).
Change-Id: Id974c7be158e4d60421a98110f5c807aefd31119
|
|
|
|
|
|
|
| |
This target wraps the to-be-logged string (With metadata) into a GSMTAP
packet and sends it to the configured destination address.
Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625
|
|
|
|
|
|
|
|
|
|
|
| |
Some targets might not want to receive only an opaque, pre-formatted
string, but rather the unformatted arguments with metadata like
sub-system/level/file/line. We solve this by introducing a
log_target->output_raw() function pointer. If a target specifies this
function, it takes precedence over the regular log_target->output()
function.
Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd
|
|
|
|
|
|
|
| |
This allows feeding a custom time for unit tests by overriding
osmo_gettimeofday.
Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
|
|
|
|
|
|
|
| |
Change-Id: Ibfc239b84879556624ca6020ae6a63d102640c94
Reviewed-on: https://gerrit.osmocom.org/114
Tested-by: Jenkins Builder
Reviewed-by: Neels Hofmeyr <nhofmeyr@sysmocom.de>
|
|
|
|
|
| |
This adds and improves doxygen API descriptions all over libosmocore,
reducing the 'white spots' that don't have any documentation.
|
|
|
|
|
| |
This is e.g. quite useful to call at the end of test code, in order to
show that all memory allocated actually is released before exit().
|
| |
|
|
|
|
|
| |
The variable is not used anymore as the decision is done in the
newly added check_log_to_target method.
|
|
|
|
|
|
| |
There doesn't seem to be a reason not to check the filter. Update
and extend the test. Currently the filter function will be called
once for the log check and once for the output of it.
|
|
|
|
|
|
| |
Extract the mapping of the subsystem number and the checking for
the loglevel to a inline method that is shared between the new
and old.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds this predicate function which can be used to
avoid the execution of code if a certain log level is not enabled.
The function will only return 0 (false), if it is sure that a logging
call for the same facility and level will not produce any output.
This safety criterion shall ensure, that no logging output is lost
due to the use of this predicate as a guard. On the other hand, even
if the predicate returns != 0 (true), no logging output might get
generated by a similar logging command.
Note that the current implementation is not focussed on performance,
which could be improved by using a lookup table instead of iterating
through every target.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
| |
This log level is used by the stats subsystem log reporter to report
statistics to level INFO. Note that the default level of DLSTATS is
NOTICE.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently when using 'logging print extended-timestamp 1', the
subsecond part (milliseconds) of the printed timestamp is always 0.
This makes it difficult to correlate log entries with PCAP file
entries if there are many of them per second.
This patch changes _output in logging.c to use gettimeofday() instead
of time() when extended timestamps are enabled and replaces the '000'
by the milliseconds computed from tv_usec.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
| |
We tried to fix it but it isn't that easy. The original fix was
cd6ed82d1ff48f47ad9e33e6322df62896a76ed5 but we had to revert it
as "everything" is present/used in existing config files.
If we ever change the ABI we can make everything be something
that is > 0. For now use a wording that makes it obvious that
people should not use "everything".
|
|
|
|
|
|
| |
First we check if a color is defined and then we call it again
and use the result. Avoid the second call and use the result of
the previous call.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We want to see from which category/subsystem a certain log message
is coming from and use a different timestamp format as well. Add
two new bitfields. This doesn't change the size of the structure
and on 32bit we still have 27bits left.
The extended timestamp will take preference over the current and
default timestamp format.
Fixes: SYS#602
|
|
|
|
|
| |
We want to use libosmocore/libosmovty in the GGSN sourcecode
and reserve a global region here.
|