summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-08-26 20:28:20 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-08-26 21:55:03 +0100
commit9420eaf44ec4067c3740b91b0be0fede08a0c515 (patch)
tree799a4ae923956a710b38fe08a3057fdce84438fd /src
parent6146412f06c2f6f33c3ea7d571f16d4fe71dddb2 (diff)
downloadlibguestfs-9420eaf44ec4067c3740b91b0be0fede08a0c515.tar.gz
libguestfs-9420eaf44ec4067c3740b91b0be0fede08a0c515.tar.xz
libguestfs-9420eaf44ec4067c3740b91b0be0fede08a0c515.zip
Add GUESTFS_EVENT_ENTER event.
This event is generated whenever a libguestfs function is called.
Diffstat (limited to 'src')
-rw-r--r--src/events.c12
-rw-r--r--src/guestfs.pod15
2 files changed, 22 insertions, 5 deletions
diff --git a/src/events.c b/src/events.c
index aa30fd2e..f707e0be 100644
--- a/src/events.c
+++ b/src/events.c
@@ -111,12 +111,14 @@ guestfs___call_callbacks_message (guestfs_h *g, uint64_t event,
count++;
}
- /* If nothing was registered and we're verbose or tracing, then we
- * print the message on stderr. This essentially emulates the
- * behaviour of the old-style handlers, while allowing callers to
- * override print-on-stderr simply by registering a callback.
+ /* Emulate the old-style handlers. Callers can override
+ * print-on-stderr simply by registering a callback.
*/
- if (count == 0 && (g->verbose || event == GUESTFS_EVENT_TRACE)) {
+ if (count == 0 &&
+ (event == GUESTFS_EVENT_APPLIANCE ||
+ event == GUESTFS_EVENT_LIBRARY ||
+ event == GUESTFS_EVENT_TRACE) &&
+ (g->verbose || event == GUESTFS_EVENT_TRACE)) {
int from_appliance = event == GUESTFS_EVENT_APPLIANCE;
size_t i;
char c;
diff --git a/src/guestfs.pod b/src/guestfs.pod
index 8cb1b867..6ccecedb 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -1833,6 +1833,21 @@ If no callback is registered: the messages are sent to stderr. You
can override the printing of trace messages to stderr by setting up a
callback.
+=item GUESTFS_EVENT_ENTER
+(payload type: function name)
+
+The callback function is called whenever a libguestfs function
+is entered.
+
+The payload is a string which contains the name of the function
+that we are entering (not including C<guestfs_> prefix).
+
+Note that libguestfs functions can call themselves, so you may
+see many events from a single call. A few libguestfs functions
+do not generate this event.
+
+If no callback is registered: the event is ignored.
+
=back
=head3 guestfs_set_event_callback