Commit Graph

14 Commits

Author SHA1 Message Date
Aleksander Morgado
4cb8ca8f0b core,log: minor coding style changes 2022-08-05 17:11:31 +02:00
som
1e08f9ca2c mm-log: hiding personal info while logging
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.
2022-04-20 15:20:34 +02:00
Aleksander Morgado
6f82ea3732 log: force using the object logging API
Unless the generic API is explicitly allowed, as in the main.c source
file.
2020-04-09 07:35:56 +02:00
Aleksander Morgado
997e2cefb8 log: define per-module logging for shared utils and plugins 2020-04-08 17:53:42 +02:00
Aleksander Morgado
e956bac47b log: common logging method definition for all testers and helpers 2020-04-08 17:53:42 +02:00
Aleksander Morgado
9bcadea172 log: new object logging support
So that we can provide the specific object id in every log associated
to a given object.
2020-04-08 16:35:08 +02:00
Torsten Hilbrich
fd0bed1df9 log: Add support for journal logging
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-21 13:08:17 +02:00
Torsten Hilbrich
b4ad1e8a21 log: Refactor evaluation of log level
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-06-21 13:02:39 +02:00
Aleksander Morgado
57f193bd04 log: remove func loc info unless MM_LOG_FUNC_LOC is defined
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"
2017-05-29 13:42:23 +02:00
Ben Chan
37b0402ee5 core: minor coding style fixes 2014-05-20 09:32:29 +02:00
Dan Williams
2d700043ab core: use g_unix_signal_add() for more reliable Unix signal handling
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.
2013-02-12 15:48:39 -06:00
Aleksander Morgado
181f9c85f0 log: only include LOC and method name in debug logs if running with --debug
If the modem is started with --log-level=DEBUG, they will not be shown.
2012-03-16 14:53:23 +01:00
Nathan Williams
1b73fa1541 Add a DBus interface for setting the log level.
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-06-30 12:25:02 -05:00
Dan Williams
16039244bb core: rework logging
Make it more flexible, add logging to a file, and absolute and
relative timestamps.
2011-01-23 20:51:48 -06:00