aboutsummaryrefslogtreecommitdiffstats
path: root/src/logging.c
AgeCommit message (Collapse)AuthorFilesLines
2015-03-18logging: Implement subsecond resolution of extended timestampsJacob Erlbeck1-4/+7
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
2014-12-28log: "logging level everything" is a badly named option.Holger Hans Peter Freyther1-1/+1
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".
2014-12-05logging: Call color only once and use the resultHolger Hans Peter Freyther1-1/+1
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.
2014-12-05logging: Make it possible to print category/subsys and timestampsHolger Hans Peter Freyther1-1/+49
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
2014-12-04gtp: Add a global region for the gtp library of OpenGGSNHolger Hans Peter Freyther1-0/+5
We want to use libosmocore/libosmovty in the GGSN sourcecode and reserve a global region here.
2014-08-21libctrl: Add DLCTRL as logging context for the control interfaceHarald Welte1-0/+5
... and make libctrl code use it
2013-12-29logging: Copy the filter_fn and fix the IMSI filter in OpenBSCHolger Hans Peter Freyther1-0/+1
The filter_fn has not been copied into the new structure breaking the imsi and other filters in OpenBSC. Looking at the code we should also introduce a callback for the reset of the context so we could use subscr_get/subscr_put on the subscriber structure.
2013-03-19Revert "Follow up fix for the log level "everything""Harald Welte1-3/+0
This reverts commit a6428d2376034d619f342897d3ce415b3f9a3584.
2013-03-19Revert "Fix log level "everything" and make it equal to "debug""Harald Welte1-1/+1
This reverts commit cd6ed82d1ff48f47ad9e33e6322df62896a76ed5.
2013-03-18logging: add new log_targets_reopen() functionHarald Welte1-0/+20
This function will re-open all existing log files in the application, praticularly useful for SIGHUP handlers in case of logrotate
2013-02-27Follow up fix for the log level "everything"Holger Hans Peter Freyther1-0/+3
Commit cd6ed82d1ff48f47ad9e33e6322df62896a76ed5 made "EVERYTHING" map to LOGL_DEBUG but when writing out the configuration the following would be written: logging level all unknown 0x0 This happend because no string was found for the value 0. Address it by adding a legacy check for 0 and write out the str from the index 0. Currently this is "EVERYTHING".
2013-02-19Fix log level "everything" and make it equal to "debug"Harald Welte1-1/+1
As Holger points out "logging level XXX everything" wasn't working, as it sets category->loglevel to 0, which is checked in osmo_vlogp() and will never get logged.
2013-01-11add some missing doxygen annotation for libosmocore functionsHarald Welte1-0/+9
2012-09-27logging.c: Do not crash on empty category nameNico Golde1-5/+7
log_parse_category_mask(), skip log category name right away if name is NULL to prevent passing a NULL ptr to strlen.
2012-09-11logging: Introduce a print_filename flag for the logtargetHolger Hans Peter Freyther1-5/+17
Introduce a print_filename attribute for each logtarget. Initialize it with 1 to be backward compatible with earlier versions. The bit is taken from an existint bitfield. There were at least six bits left of the byte.
2012-09-11logging: Mark the log_info_cat pointer as constsHolger Hans Peter Freyther1-2/+3
Applications should keep the log area in a static const area. Mark the pointer as const to address compiler warnings in OpenBSC, cast the const away for the osmo_log_info as it is not declared as const.
2012-07-12logging: Fix compile breakage introduced by the warning fixesHolger Hans Peter Freyther1-4/+4
Make sure the declaration and definition match, add const to the functions called by logp/logp2. Compile output: logging.c:317: error: conflicting types for 'logp' ../include/osmocom/core/logging.h:34: note: previous declaration of 'logp' was here logging.c:327: error: conflicting types for 'logp2' ../include/osmocom/core/logging.h:168: note: previous declaration of 'logp2' was here make[3]: *** [logging.lo] Error 1
2012-04-18doc: Fix the Doxygen section endingsSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12gsm/sms: Added DLSMS debuggingAndreas Eversberg1-0/+6
Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-10Changed logging of LAPD from DLLAPDM to DLLAPDroot1-3/+3
2011-08-31logging: add osmo_vlogp() as vararg / va_list compatible functionHarald Welte1-4/+5
2011-08-17doxygen documentation for logging frameworkHarald Welte1-5/+79
2011-08-11logging: fix parsing of logging mask (-d DMI case)Pablo Neira Ayuso1-0/+5
Without this patch, `-d DMI' enables logging for DMI and DMIB. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-07-29use the 'L' prefix in debug names (DLINP instead of DINP)Harald Welte1-4/+4
2011-07-21remove DLRSL and DLNM, we don't need themHarald Welte1-12/+0
They are not used anywhere in our libraries, so they should be defined by the respective applications
2011-07-19make sure we don't have namespace clashes between libraries and appsHarald Welte1-6/+6
* All loging prefixes in libraries should be DL like DLINP * All signals / subsystems should be called S_L_* SS_L_* * All command nodes should be called L_*_NODE This makes sure existinc code still compiles as expected
2011-07-18logging: add libosmo-abis logging subsystemsPablo Neira Ayuso1-0/+34
This adds the libosmo-abis logging subsystems to libosmocore, it uses the new change that harald proposed based on negative numbers for library logging subsystems.
2011-07-02fix against corrupted output in parallel loggingHarald Welte1-1/+1
In 825607672215b7a12ea6e201a89cd5209f6d657f it was attempted to fix a bug previously introduced by logging related changes. The problem is that a va_list can be corrupted after it has been used once, so we need to va_copy before each successive use. And if we copy it, we also need to use the copy, and not the original ;)
2011-06-27Fix the generation of the log_categories string + LAPDMHarald Welte1-4/+7
... I should do more testing :( Conflicts: src/logging.c
2011-06-27logging: make sure to add the internal categories, as intendedHarald Welte1-0/+6
2011-06-27add LAPDm code from osmocom-bb into libosmocore0.3.3Harald Welte1-0/+6
2011-06-27logging: introduce library-internal logging categoriesHarald Welte1-20/+92
We do this by using a trick: library-internal log categories use negative subsystem numbers, which are converted into positive array indexes at the time of logging. library-internal log categories need to be knwo at compile-time, while application-specified categories now are of unlimited number, as they are dynamically allocated.
2011-05-19logging: fix corrupted outputPablo Neira Ayuso1-0/+6
Harald reported a problem in the logging: http://lists.osmocom.org/pipermail/openbsc/2011-May/002896.html Reverting 81e9636454294ae10ef9bc8bf149dd0248afce76 seems to fix the problem. However, that workaround looks ugly. Holger gives us another clue on what was wrong: http://lists.osmocom.org/pipermail/openbsc/2011-May/002905.html While digging in the manpage, I found this: "The functions vprintf(), vfprintf(), vsprintf(), vsnprintf() are equivalent to the functions printf(), fprintf(), sprintf(), snprintf(), respectively, except that they are called with a va_list instead of a variable number of arguments. These functions do not call the va_end macro. Consequently, the value of ap is undefined after the call. The application should call va_end(ap) itself afterwards."
2011-05-04logging: make sure the output is null-terminatedPablo Neira Ayuso1-0/+2
If we reach the buffer size or snprintf fails, we want to make sure that the output is null-terminated.
2011-05-04logging: remove workaround now that _output() has been reworkedPablo Neira Ayuso1-12/+3
This patch removes a workaround to fix some strange memory corruption now that _output() has been completely reworked and we make use of snprintf appropriately.
2011-05-04logging: rework _output() functionPablo Neira Ayuso1-23/+26
This patch reworks _output() to handle snprintf() return value appropriately and to use one single buffer to build the logging string, instead of four.
2011-05-04logging: several memory allocation belong to tall_log_ctx contextPablo Neira Ayuso1-2/+2
Several talloc_zero in logging use NULL context, use tall_log_ctx instead.
2011-05-04logging: fix missing description of global loglevelPablo Neira Ayuso1-0/+7
OpenBSC> logging level all Global setting for all subsystems <----- this description was missing rll A-bis Radio Link Layer (RLL) [...] This problem was introduced by myself in: "vty: integration with logging framework" 04139f14b6197e3ec996133a945af3fa8a68fb7a
2011-03-29logging: Add the 'all' category back to the log level commandHolger Hans Peter Freyther1-1/+1
This is required to be able to set a global log level. The all command is emitted by the VTY logging code.
2011-03-28utils: move OSMO_SNPRINT_RET() macro definition to osmocom/core/utils.hPablo Neira Ayuso1-18/+8
This is used by the logging to vty conversion functions by now, but it may be of help for other functions that plan to use snprintf().
2011-03-23include: reorganize headers file to include/osmocom/[gsm|core]0.2.0Pablo Neira Ayuso1-3/+3
This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-19vty: integration with logging framework0.1.31Pablo Neira Ayuso1-23/+115
The logging categories are registered by the applications, like osmo-nitb, during startup. Thus, the VTY have to provide the logging commands according to the logging categories that the application has registered. Before this patch, the VTY contained the logging categories hardcoded. Thus, any change in the logging categories by the application would not be shown by the VTY. So far, this was not a problem because all applications used the same logging categories. However, according to what Harald told me, this may be a problem in the future. This patch resolve the lack of integration between the logging framework and the VTY by generating the VTY logging commands from the logging categories registered. Since this patch changes one function of the libosmocore API, it follows another patch for the openbsc application to get in sync with the new function layout. I have reworked and renamed the functions: * log_vty_category_string() * log_vty_level_string() to provide the new ones that generate the exact output that VTY requires. This patch does not release the memory allocated by talloc_zero_size() to store the VTY strings for the commands and the description. I found no exit function that can clean up resources that were allocated.
2011-02-18LOGGING: configure logging from the vtyHarald Welte1-3/+21
We can now configure logging to (multiple) files, stderr and syslog from the vty command line in a persistent way (config file)
2011-02-17LOGGING: Pass the log level down to the log target output functionHarald Welte1-5/+6
This will be required for mapping osmocore log levels to syslog priorities.
2010-09-17Make sure we don't user std{err,in,out} if they don't exist.Sylvain Munaut1-4/+5
This is required for target build in libosmocore Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-08-25logging: add log target logging into text file and log target destroy functionHarald Welte1-0/+50
2010-08-25logging: rename tgt_stdout to tgt_fileHarald Welte1-5/+5
2010-07-30logging: Make sure we don't use "end of color" code if colors are turned offHarald Welte1-1/+2
2010-07-30move hexdump() from logging.c to utils.cHarald Welte1-19/+0
2010-05-25rename log_info to osmo_log_info to avoid namespace clash with appHarald Welte1-15/+15