Commit Graph

12 Commits

Author SHA1 Message Date
Manawyrm 11a416827d logging: ensure ANSI color escape is sent in same line/before newline
This fixes multi-line color clobbering in logging daemons like
systemd-journald, which work with single-lines only.

Change-Id: Ia7de9d88aa5ac48ec0d5c1a931a89d21c02c5433
Closes: OS#6249
2023-11-07 16:50:22 +00:00
Oliver Smith 04bfb7165b treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2021-12-14 12:44:03 +01:00
Pau Espin 01e0d3e7fd Drop use of log_set_print_filename() API inside libosmocore
Let's use log_set_print_filename2() API instead, which has less ackward
behavior implications like changing the print status of category-hex.

Related: OS#5034
Change-Id: Ifc78e1dcba5baf0b41f6ccbbbd1e3f06552d73da
2021-02-20 17:13:58 +00:00
Pau Espin 690b661fbc tests: Set print_category values explicitly
This will alow easily changing default values for print_category vs
print_category_hex later.

In any case, every test relying on logging output validation should
always explicitly state the config to avoid issues in the future if
default values change.

Related: OS#5034
Change-Id: If29b40557d5c2bcda04b964f344070bad58d8f28
2021-02-20 17:13:58 +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
Holger Hans Peter Freyther 53aa0f51b8 license: Fix the license to GPL
This was always intended to be GPL and not AGPL. "kat" did the
development as part of an internship paid by me and we agreed
to shared copyright.

Change-Id: Ied2041ba20c5737bd967dfaa3017edf72a95b31c
2017-12-09 13:03:29 +00:00
Holger Hans Peter Freyther 6b1faf7362 logginrb: Fix compiler warning about fprintf
loggingrb/loggingrb_test.c:76:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stderr, log_target_rb_get(ringbuf_target, 0));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
loggingrb/loggingrb_test.c:77:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stderr, log_target_rb_get(ringbuf_target, 1));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-04-11 19:33:10 +02:00
Michael McTernan 4e0543f730 Tests: Fix broken loggingrb testcase.
The loggingrb (ringbuffer) test case was not actually being built or ran, instead still using the normal logging test.

This patch fixes the makefile, then the loggingrb testcase is changed to use the current loggingrb API so that it builds and passes.

Signed-off-by: Michael McTernan <mike.mcternan@wavemobile.com>
2015-04-01 20:50:26 +02:00
Katerina Barone-Adesi 008e53baae utils: Introduce OSMO_ASSERT in the utils and use it in the unit tests
The tests should unconditionally assert, regardless of debug settings.
This uses the OSMO_ prefix as it's in the global namespace.
2013-03-09 23:52:29 +01:00
Katerina Barone-Adesi 3309a43ef5 Added a ring buffer log target to store the last N log messages.
The log target can be used via log alarms and show alarms.
Why? This feature was proposed/requested at
http://openbsc.osmocom.org/trac/wiki/Tasks/ErrorLogTarget
All messages use the same amount of space, prioritizing simplicity.
2013-02-27 15:13:45 +01:00
Holger Hans Peter Freyther efd2bd691f Revert "Added a ring buffer log target to store the last N log messages."
I noticed some more issues and it is the easiest to revert and include
the fixed version.

This reverts commit 73377229bb.
2013-02-27 14:51:33 +01:00
Katerina Barone-Adesi 73377229bb Added a ring buffer log target to store the last N log messages.
The log target can be used via log alarms and show alarms.
Why? This feature was proposed/requested at
http://openbsc.osmocom.org/trac/wiki/Tasks/ErrorLogTarget
All messages use the same amount of space, prioritizing simplicity.
2013-02-27 14:45:48 +01:00