summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/logging.h
Commit message (Collapse)AuthorAgeFilesLines
* cosmetic: logging.h: fix comment s/levels/subsystemsNeels Hofmeyr2019-11-231-1/+1
| | | | Change-Id: I242a4a44649bc4dac055985ba8fd63b2f784ee6d
* logging.h: define ansi color constantsNeels Hofmeyr2019-11-231-0/+19
| | | | | | | | | | | 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
* logging: Introduce mutex API to manage log_target in multi-thread envsPau Espin Pedrol2019-10-091-0/+14
| | | | | | | | | | | | | | | | | | | | 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
* logging: Move extern declaration of osmo_log_target_list from logging.h to ↵Pau Espin Pedrol2019-09-201-1/+0
| | | | | | | | | logging_internal.h This list is really not needed by applications and currently only used internally in logging.c and logging_vty.c. Change-Id: I5dca069512bfcd0826194427c5482fad8bfd0232
* logging.h: add L1 SAPI related context and filterOliver Smith2019-09-181-0/+2
| | | | | | | First user is osmo-bts in I6b7bb2e1d61502b61214f854a4ec5cbb7267545b. Related: OS#2356 Change-Id: I814cb3328d99faca9220adb5a80ffb934f219d7d
* minor: don't redefine macrosKévin Redon2019-06-131-0/+2
| | | | | | | | | | | the DEBUG macro name and ARRAY_SIZE macro function are frequently used in other projects. If these projects also use libosmocore, the macros will be redefined. This also generates a warning message during compilation. Not redefining the macros removes the warning message and possible (but unlikely) mis-redefinition. Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
* logging vty: rewrite 'logging level' vty cmd generationNeels Hofmeyr2018-09-131-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Completely drop the implementations of log_vty_command_{str,description}(). These functions have been public API once, marked as deprecated since c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7 (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
* Add RSPRO support to IPA and logging definitionsHarald Welte2018-09-031-1/+2
| | | | Change-Id: Iee79f5273f32cb9ce4bd7a984e7f0625542e776f
* log: add 'last' option to 'logging print file'Neels Hofmeyr2018-08-271-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* use __FILE__, not __BASE_FILE__Neels Hofmeyr2018-08-201-6/+6
| | | | | | | | | | | | | | | The intention was to use the file's basename, but __BASE_FILE__ means "the root file that is being parsed and contains #include statements". If we had a function using __BASE_FILE__ and that was defined in an #included file, __BASE_FILE__ would indicate the first file where the #include is, and not the file where the function is defined. __BASE_FILE__ works for us because we don't ever include function definitions that log something, so __BASE_FILE__ always coincides with __FILE__ for our logging; but still __BASE_FILE__ is semantically the wrong constant. Related: OS#2740 Change-Id: Ibc1d3746f1876ac42d6b1faf0e5f83bd2283cdcc
* core/logging.h: Add logging category for jitter bufferPau Espin Pedrol2018-02-271-1/+2
| | | | | | Forthcoming jitter buffer code in libosmo-netif will make use of it. Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
* logging: allow to log only the basename of each sourceNeels Hofmeyr2018-01-191-0/+1
| | | | | | | | | | | 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
* logging: separate the '<000b>' subsys from filename loggingNeels Hofmeyr2018-01-191-1/+13
| | | | | | | | | | | | | | | | | | | 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
* logging: add ability to log the log-level with API and vtyNeels Hofmeyr2018-01-171-0/+4
| | | | | | | | Log the log level string after the category name, if enabled. The default behavior remains unchanged. Change-Id: Ie6be365cfa6aeabdf115bff19bac198440c9adf1
* logging: Extend the LOGPSRC macro to put cont in it as wellHolger Hans Peter Freyther2017-12-011-2/+18
| | | | | | | | For the lua console printing I need to print several values with continuation but also specify the filename. Add a "C" for continue and forward arguments. Change-Id: I1d6dcb2567b9ed2c8767f661737b979bc3d1377e
* add DLMGCP logging category for libosmo-mgcpNeels Hofmeyr2017-07-181-1/+2
| | | | | | | 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
* Deprecate wrappers around loglevel_strsMax2017-07-081-2/+2
| | | | | | | | Add deprecation notice for public API use: it shouldn't be used outside of libosmocore anyway. Change-Id: I792e30dc44f027fd94e1f65af19fe08bac52b95c Related: OS#71
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-3/+1
| | | | | | | | | | | | | | | | | 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
* api doc typo fix in core/logging.hNeels Hofmeyr2017-06-231-1/+1
| | | | Change-Id: I3f1cd5b10e7beccb61f370d7f8fa2666e56542cf
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-49/+49
| | | | | | | | | | 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
* Fix compilation warning on deprecated macroPau Espin Pedrol2017-06-181-2/+2
| | | | | | | | | A warning was printed even if the deprecation didn't apply to libosmocore because it is still allowed to use it internally. This patch fixes this case while still printing a warning if external projects build using libosmocore headers. Change-Id: I32212f20756f828af1017482a71e29e4b3adbad4
* vty: cleanup logging functionsMax2017-05-091-2/+2
| | | | | | | | | | | | * 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
* logging.h: #define DLSS7, DLSCCP, DLSUA, DLM3UA for libosmo-sigtranHarald Welte2017-04-031-1/+5
| | | | Change-Id: I61f452208088dc7097165deecef7c058ebb4bd4e
* logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr2017-02-231-16/+18
| | | | | | | | | | | | | | | 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
* logging.h: fixup: add API doc for logging enums recently addedNeels Hofmeyr2017-02-231-0/+5
| | | | Change-Id: Ic459b04219abe70171c8f80ed09df53d412dcfb2
* logging.h: fix backwards compat broken by recent commitNeels Hofmeyr2017-02-231-0/+7
| | | | | | | | | | | | | | Commit 812ba6dc63a75c39678dd3fe652768e76bf63183 "logging: centrally define ctx and filter indexes" Removed definitions, which causes older e.g. openbsc and osmo-pcu code trees to fail to build against a newer libosmocore. Re-introduce the legacy definitions to redirect to the new ones and re-establish backwards compatibility. The GPRS_* constants used to be defined in gprs_msgb.h, but since that header also includes logging.h, rather place the legacy shims in logging.h next to the other ones. Change-Id: I455bb1bb474d758af0fd5b6397f7e57260ad739d
* logging: centrally define ctx and filter indexesNeels Hofmeyr2017-02-221-2/+17
| | | | | | | | | | | | | | | | | | | | | | | 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
* logging: remove code duplicationMax2017-01-161-13/+4
| | | | | | | | * make DEBUGP* macro into simple wrappers around LOGP* * deprecate unused logp() function Related: OS#71 Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93
* fsm: log caller's source for events and state changes, not fsm.c linesNeels Hofmeyr2016-12-141-4/+23
| | | | | | | | | | | | | | | | | | | | | | | When looking at log output, it is not interesting to see that a state transition's petty details are implemented in fsm.c. Rather log the *caller's* source file and line that caused an event, state change and cascading events. To that end, introduce LOGPSRC() absorbing the guts of LOGP(), to be able to explicitly pass the source file and line information. Prepend an underscore to the function names of osmo_fsm_inst_state_chg(), osmo_fsm_inst_dispatch() and osmo_fsm_inst_term(), and add file and line arguments to them. Provide the previous names as macros that insert the caller's __BASE_FILE__ and __LINE__ constants for the new arguments. Hence no calling code needs to be changed. In fsm.c, add LOGPFSMSRC to call LOGPSRC, and add LOGPFSMLSRC, and use them in above _osmo_fsm_inst_* functions. In addition, in _osmo_fsm_inst_term(), pass the caller's source file and line on to nested event dispatches, so showing where a cascade originated from. Change-Id: Iae72aba7bbf99e19dd584ccabea5867210650dcd
* import oap message parsing / encoding from openbsc.git; AGPL->GPLHarald Welte2016-12-111-1/+2
| | | | | | | | | | | | | | | | | | | 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
* fix: DLGSUP logging category "unusable"Neels Hofmeyr2016-12-111-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Implement GSMTAP log targetHarald Welte2016-12-091-0/+14
| | | | | | | 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
* logging: Extend log_target with call-back for un-formatted log lineHarald Welte2016-12-021-1/+17
| | | | | | | | | | | 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
* logging: Use __BASE_FILE__ instead of __FILE__Harald Welte2016-05-121-4/+4
| | | | | | | | | | | | | | Apparently __FILE__ expands to nasty '../../..' paths when BUILDDIR != SRCDIR. This in turn leads to ugly log lines like: <0000> ../../../../osmo-bts/src/common/rsl.c:1642 (bts=0,trx=0,ts=0,ss=0) Handing RLL msg UNIT_DATA_IND from LAPDm to MEAS REP Where we certainly wouldn't want the "../../../../osmo-bts" part. Change-Id: If6d2de33c3b6bb2943954bbd81eff261dc279d58 Reviewed-on: https://gerrit.osmocom.org/38 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
* import gprs_gsup_message.[ch] from openbsc as gsup.[ch]Harald Welte2016-05-061-1/+2
| | | | | | | Move those routines from OpenBSC to libosmogsm, so they can be re-used from other programs. I think it was a mistake to add them only inside the openbsc repository in the first place. We need to pay more attention to this in the future.
* Update doxygen annotations in libosmocoreHarald Welte2016-05-051-17/+23
| | | | | This adds and improves doxygen API descriptions all over libosmocore, reducing the 'white spots' that don't have any documentation.
* Add log_fini() function to release all memory allocated by logging frameworkHarald Welte2016-05-051-0/+1
| | | | | 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().
* log: Add conditional logging based on log_check_levelJacob Erlbeck2016-02-291-4/+20
| | | | | | | | | | | | | | Currently the LOGP/DEBUGP arguments are always evaluated even if no logging will happen at all. This can be expensive, for instance if hexdumps or pretty printed object names are generated. This causes high base load especially on embedded devices and is a major part of CPU usage e.g. of the osmo-pcu. This commit uses the log_check_level function to avoid the evaluation of the parameters if it is known in advance, that no logging entry will be generated. Sponsored-by: On-Waves ehf
* log: Add log_check_level functionJacob Erlbeck2016-02-291-0/+1
| | | | | | | | | | | | | | | | | | 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
* log: Add new DLSTATS log levelJacob Erlbeck2015-11-021-1/+2
| | | | | | | | 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
* logging: Make it possible to print category/subsys and timestampsHolger Hans Peter Freyther2014-12-051-0/+6
| | | | | | | | | | | | 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
* gtp: Add a global region for the gtp library of OpenGGSNHolger Hans Peter Freyther2014-12-041-1/+2
| | | | | We want to use libosmocore/libosmovty in the GGSN sourcecode and reserve a global region here.
* logging: Add ability to save/print current log filtersHarald Welte2014-08-251-0/+16
| | | | | | This enables the persistent configuration of let's say 'log filter imsi 012345678' for a given log file in the config file.
* libctrl: Add DLCTRL as logging context for