aboutsummaryrefslogtreecommitdiff
path: root/src/mm-log.c
AgeCommit message (Collapse)Author
2022-11-04libmm-glib,common: add helpers to build printable stringsAleksander Morgado
2022-11-04log: allow querying whether personal info should be shown or notAleksander Morgado
We need this when building printable representations of helper types like the MMBearerProperties object.
2022-11-04log: new methods to check if a given logging level is enabledAleksander Morgado
There are certain cases where we perform a lot of data processing just for logging purposes. Having methods that let us know whether a given log level will be printed before doing all that data processing is useful.
2022-11-04log: new helper to allow printing or hiding personal infoAleksander Morgado
2022-11-04core,log: reduce the log level tag to 3 charactersAleksander Morgado
Just to make all of them the same avoid needing extra whitespaces just for alignment of the text after this tag.
2022-11-04core,log: new 'MSG' log level between 'INFO' and 'WARN'Aleksander Morgado
We're bumping the current "INFO" level messages to the new "MSG" level, also making the new level the default. The old "INFO" level will be used to setup an intermediate level of logging which is not as verbose as "DEBUG" but still provides some capabilities to analyze the behavior of a modem.
2022-08-25mm-log: hiding personal info while logging for QMI modemAkash Aggarwal
2022-08-05core, log: make libraries logging use the MM level and formatAleksander Morgado
The log level of the libraries was not honoring the log level configured in MM, so we would see debug messages reported even if the default log level configured was INFO or MSG. The format of the logs emitted by the libraries was also not following the format of the rest of MM logs, e.g. they would not include timing info in the logs which would make it hard to follow certain event transitions. Make the libraries logging use the ModemManager logging method, to fix all those issues.
2022-08-05core,log: minor coding style changesAleksander Morgado
2022-04-20mm-log: hiding personal info while loggingsom
During mm logging, some of the information like simIccId, Telephone numbers need to be hidden from displaying in the logs to protect some of the user information. Implemented for MBIM requiring libmbim 1.27.6, which is the development version that includes the needed API.
2021-05-18core: drop "volatile" for g_once_init_enter locationsAleksander Morgado
This fixes a few (fatal in gcc 11) warnings. See https://gitlab.gnome.org/GNOME/glib/-/issues/600
2021-04-14log: enable QRTR loggingAndrew Lassalle
Add the 'Qrtr' domain so logging from libqrtr is enabled.
2020-10-25log: ignore fatal flag for logging purposesAleksander Morgado
Running with G_DEBUG=fatal-warnings will end up reporting warning logs with G_LOG_FLAG_FATAL, which breaks our own logging logic.
2020-04-08log: define per-module logging for shared utils and pluginsAleksander Morgado
2020-04-08log: common logging method definition for all testers and helpersAleksander Morgado
2020-04-08log: new object logging supportAleksander Morgado
So that we can provide the specific object id in every log associated to a given object.
2020-01-30core,log: fix warnings with -Wswitch-enumAleksander Morgado
mm-log.c: In function ‘glib_to_syslog_priority’: mm-log.c:99:5: warning: enumeration value ‘G_LOG_FLAG_RECURSION’ not handled in switch [-Wswitch-enum] 99 | switch (level) { | ^~~~~~ mm-log.c:99:5: warning: enumeration value ‘G_LOG_FLAG_FATAL’ not handled in switch [-Wswitch-enum] mm-log.c:99:5: warning: enumeration value ‘G_LOG_LEVEL_INFO’ not handled in switch [-Wswitch-enum] mm-log.c:99:5: warning: enumeration value ‘G_LOG_LEVEL_MASK’ not handled in switch [-Wswitch-enum]
2020-01-30core,log: fix warnings with -Wswitch-defaultAleksander Morgado
mm-log.c: In function ‘mm_to_syslog_priority’: mm-log.c:82:5: warning: switch missing default case [-Wswitch-default] 82 | switch (level) { | ^~~~~~ mm-log.c: In function ‘log_level_description’: mm-log.c:118:5: warning: switch missing default case [-Wswitch-default] 118 | switch (level) { | ^~~~~~
2017-07-17log: minor coding style fixesBen Chan
2017-06-21log: Add support for journal loggingTorsten Hilbrich
This logging is available if the software was build with the configure option --with-systemd-journal. It will be enabled by default if libsystemd is found. The runtime parameter --log-journal enables to output of log messages to the systemd journal. Please note that the journal priority field has the same value as the syslog level so no conversion is required here.
2017-06-21log: Introduce function pointer to handle different log backendsTorsten Hilbrich
This allows for easier additions of other logging mechanism. Using the syslog loglevel as parameter because we need to be able to map the MMLogLevel and the GLogLevelFlags to a common representation when using the log_backend in _mm_log and log_handler. The syslog level is more suitable because it supports more values than the MMLogLevel.
2017-06-21log: Add mapping from glib loglevel to syslog priorityTorsten Hilbrich
Improves readability of log_handler function.
2017-06-21log: Refactor log level text outputTorsten Hilbrich
Adding a helper function to turn the log level into the text. Also add an internal flag to disable this output. This flag will become useful when adding systemd journal support.
2017-06-21log: Refactor evaluation of log levelTorsten Hilbrich
Starting with adding a typed enum type for the log level named MMLogLevel. Suggested-By: Aleksander Morgado <aleksander@aleksander.es> The level was checked twice in _mm_log. Once at the beginning and again when turning the level into both the syslog priority and some descriptive text which was added to the log level. Removing the check at the second location as it was redundant. Also adding a helper function to turn the MMLogLevel into the syslog equivalent. This will become handy when adding support for systemd journal.
2017-05-29log: remove func loc info unless MM_LOG_FUNC_LOC is definedAleksander Morgado
The user can build the project passing custom CFLAGS to enable the function location information, e.g.: $ ./configure --prefix=/usr CFLAGS="-DMM_LOG_FUNC_LOC"
2013-04-18core: rework logging code to remove log message truncation (bgo #698312)Dan Williams
Use a static GString which will resize itself if the log message is bigger than the current string size, but will also ensure we don't do a ton of memory reallocation on every log message. Previously all log messages were trucated at 512 bytes due to the log buffer char array being 512 bytes long.
2013-04-17log: enable MBIM traces if running in debug modeAleksander Morgado
2013-02-12core: use g_unix_signal_add() for more reliable Unix signal handlingDan Williams
There were a few problems with MM's existing signal handling, first of which was that calling g_main_loop_quit() from a signal handler only works 50% of the time due to severe restrictions on what you can do from the handler. This caused INT or TERM to sometimes be ignored by MM. Instead, use the glib signal functions which ensure that the handler is run in the right context, where we can do anything we want.
2012-10-30core,log: include logging from the 'Qmi' log domainAleksander Morgado
Sync with libqmi: commit 2835a53732fdae32478dd954a9ee3fa8afd93cab Author: Aleksander Morgado <aleksander@lanedo.com> Date: Tue Oct 30 15:02:24 2012 +0100 libqmi-glib: define library G_LOG_DOMAIN
2012-10-09log: enable QMI traces when showing debug logsAleksander Morgado
Use the new `qmi_utils_set_traces_enabled()' to specify that we want QMI traces when running with DEBUG logs. Sync with libqmi: commit 35dcb4bb6ed2755d968cf97d69faff9ed5f6871f Author: Aleksander Morgado <aleksander@lanedo.com> Date: Tue Oct 9 13:44:16 2012 +0200 libqmi-glib: message traces compiled always Message traces have been very useful when debugging issues in the protocol, and we should avoid requiring a full recompilation in order to get them enabled. Instead, we provide two new API methods, `qmi_utils_(get|set)_traces_enabled()', which allow specifying whether traces should be dumped with g_debug() or not.
2012-03-16log: only include LOC and method name in debug logs if running with --debugAleksander Morgado
If the modem is started with --log-level=DEBUG, they will not be shown.
2012-03-15core: start using our newly defined errorsAleksander Morgado
2011-06-30Add a DBus interface for setting the log level.Nathan Williams
Lifted almost entirely from similar code in NetworkManager. BUG=chromium-os:15197 TEST='dbus-send --print-reply --system --dest=org.freedesktop.ModemManager /org/freedesktop/ModemManager org.freedesktop.ModemManager.SetLogging string:DEBUG' Also try valid log levels 'ERR', 'WARN', 'INFO', and an invalid log level, such as 'ABCDE'. Change-Id: I2bddcd0319f4966dd293b119f68e7cc1697949b7 Reviewed-on: http://gerrit.chromium.org/gerrit/3134 Tested-by: Nathan J. Williams <njw@chromium.org> Reviewed-by: Eric Shienbrood <ers@chromium.org>
2011-02-25logging: use glong for secs and usecsMichael Biebl
2011-02-25log: fix spacing so messages line upDan Williams
2011-01-24logging: make gcc 4.4.3 happy about ignored unused resultsDan Williams
2011-01-24logging: shut up compiler warnings about unused result from write(2)Dan Williams
We actually don't care about the result here. But we do in other places, so we want to keep the warning in general.
2011-01-23core: rework loggingDan Williams
Make it more flexible, add logging to a file, and absolute and relative timestamps.