Commit Graph

21 Commits

Author SHA1 Message Date
Thomas Haller
f4f3f4d69b core/logging: make log level and domain a C enum
This way the compiler issues a warning when accidently
switching the level and domain arguments when logging.

Make LOGD_ALL and LOGD_DEFAULT members of the enum instead
defining them. Previously the LOGD_ALL define included all
the defined domains, hence this is no functional change.

Also define the logging domain aliases as enum members (instead
of preprocessor defines).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-30 14:18:16 +01:00
Thomas Haller
4e404212fc core/logging: adjust numerical values of the logging domain flags
The numerical value 0x01 was unused. Shift all the values
to fill the "hole".

Fixes: 552ed76f59
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-30 12:45:30 +01:00
Dan Winship
115f8bead8 libnm-core, core: merge NMLoggingError into NMManagerError
NMManagerError has other operation-specific errors (like
NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE), so it makes sense to move
NM_LOGGING_ERROR_UNKNOWN_LEVEL and NM_LOGGING_ERROR_UNKNOWN_DOMAIN
there too rather than having them in their own tiny error domain.
2014-10-22 08:29:09 -04:00
Thomas Haller
bdea7d61d0 logging: add new logging level "TRACE"
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-05 18:24:36 +02:00
Dan Winship
c81fb49aa5 all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).

Fix this by changing the include guards in the non-API-stable parts of
the tree:

  - libnm-glib/nm-ip4-config.h remains   NM_IP4_CONFIG_H
  - libnm/nm-ip4-config.h now uses     __NM_IP4_CONFIG_H__
  - src/nm-ip4-config.h now uses       __NETWORKMANAGER_IP4_CONFIG_H__

And likewise for all other headers.

The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-16 10:17:14 -04:00
Thomas Haller
ca7329f7d4 core/logging: add new logging macro nm_log_obj()
Add new macro nm_log_obj() to prefix the log line with a pointer value
as identifier. This macro can be used to give each logging line a common
prefix with defined format. It is mainly intended to print a message
"for" an object, for example inside a method function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
573576bedd core/logging: define nm_log() to check for nm_logging_enabled() first
Change the definition of nm_log() to first check whether logging is
enabled. This has the benefit, that the logging arguments don't have
to be evaluated if logging is disabled.

With this change, you must ensure, that calling any logging function
is side-effect-free. For example:
    nm_log_debug ("This is a bug %s, %d", has_side_effect (), ++i);
would be a bug, because the logging arguments get only evaluated
depending on the logging setup.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
7509d4f80f core/logging: change order or domain/level arguments for nm_log()
Now the order of arguments corresponds to nm_logging_enabled().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
60cf1b8fcd core/logging: define logging macros based on nm_log()
Base the definition of nm_log_*() macros on the nm_log() macro,
instead of directly on the _nm_log() function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
453d1aa71d core/logging: return static string from nm_logging_domains_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
85b972e9b8 core/logging: return static string from nm_logging_level_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
a69037431c core/logging: remove unused #undef from header file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Dan Winship
8aa3b9859b core: merge src/config, src/logging, src/posix-signals into src/
Some subdirectories of src/ encapsulate large chunks of functionality,
but src/config/, src/logging/, and src/posix-signals/ are really only
separated out because they used to be built into separate
sub-libraries that were needed either for test programs, or to prevent
circular dependencies. Since this is no longer relevant, simplify
things by moving their files back into the main source directory.
2014-07-30 15:56:29 -04:00
Dan Williams
a00a6e5d87 logging: move logging into its own subdir
Some stuff we build (the DHCP manager) gets built independently
so that we can use it for unit tests.  For that, we need to build
the logging bits separately too, since the independent DHCP
library can't use them if they are embedded in NM.
2010-04-06 17:39:57 -07:00
Dan Williams
8faf8c91ef logging: add DEVICE logging domain 2010-04-06 16:25:42 -07:00
Dan Williams
52c2422f72 logging: add log level helpers 2010-04-06 15:46:03 -07:00
Dan Williams
32128b04ca logging: add basic logging capabilities 2010-04-06 15:23:08 -07:00
Dan Williams
24e50f7f6f 2008-11-02 Dan Williams <dcbw@redhat.com>
* Add license headers to everything in src/



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4247 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-03 04:13:42 +00:00
Dan Williams
b0cf66eda8 2008-06-26 Dan Williams <dcbw@redhat.com>
* Update FSF address in license headers (Michael Biebl <biebl@debian.org>)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3775 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-26 18:31:52 +00:00
Tambet Ingo
3dcd9d2d17 2007-02-19 Tambet Ingo <tambet@ximian.com>
* src/vpn-manager/nm-vpn-manager.c: Handle the DBUS state changes itself.
	Handle device state changes and disconnect VPN if it's device deactivates.

	* src/nm-dbus-nm.c: 
	* src/nm-dbus-nm.h: 
	* src/nm-dbus-device.c: 
	* src/nm-dbus-device.c: 
	* src/nm-dbus-net.c: 
	* src/nm-dbus-net.h: Remove. All of it is implemented byt the new dbus API.

	* src/NetworkManagerMain.h: Get rid of all but 3 properties of NMData.

	* src/nm-device.c (nm_device_get_by_udi):
	(nm_device_get_by_iface): Remove. This doesn't belong here and is already
	implemented in the correct location (NMManager).
	Rip out all the test_device stuff.

	* src/NetworkManagerPolicy.c: Remove the leftover activation success and
	failure handlers, it's all done by NMDevice already.

	* src/NetworkManager.c: Move the signal handling here from nm-logging.c
	Remove the iochannel hack to route the unix signals to the main thread since
	we're not threaded anymore.

	* src/NetworkManagerAP.c: Implement HWAddress property.

	* src/NetworkManagerDbus.c: Remove the dbus signal sending code, it happens
	automatically with dbus-glib.

	* src/nm-netlink-monitor.c: 
	* src/nm-netlink-monitor.h:
		- Move it low in the class hierarchy, don't reference any NM types.
		- Remove private data from the header.
		- Use type safe checks in public API methods.
		- Make it a singleton so we don't have to pass the single reference around.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2339 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-02-19 13:09:32 +00:00
Dan Williams
b06df42628 2006-02-26 Dan Williams <dcbw@redhat.com>
* src/Makefile.am
		- make and install nm-crash-logger

	* src/nm-logging.[ch]
	  	- New files; consolidate logging and crash handling

	* src/nm-crash-logger.c
	  src/gdb-cmd
		- Standalong crashlogger for NM, grab a backtrace
			using GDB

	* src/NetworkManager.[ch]
		- Remove signal handling and put it into nm-logging.c


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1499 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2006-02-27 04:31:52 +00:00