diff -u -r -N -p DirectFB-1.2.0.orig/lib/direct/log.c DirectFB-1.2.0/lib/direct/log.c
--- DirectFB-1.2.0.orig/lib/direct/log.c	2008-06-02 07:07:44.000000000 +0100
+++ DirectFB-1.2.0/lib/direct/log.c	2008-10-06 16:08:31.608658373 +0100
@@ -56,6 +56,8 @@ struct __D_DirectLog {
 
      int             fd;
 
+	 DirectLogFunc   func;
+
      pthread_mutex_t lock;
 };
 
@@ -79,6 +81,9 @@ static DirectResult init_file  ( DirectL
 static DirectResult init_udp   ( DirectLog  *log,
                                  const char *hostport );
 
+static DirectResult init_func  ( DirectLog  *log,
+                                 DirectLogFunc func );
+
 /**********************************************************************************************************************/
 
 DirectResult
@@ -107,6 +112,10 @@ direct_log_create( DirectLogType   type,
           case DLT_UDP:
                ret = init_udp( log, param );
                break;
+			   
+		  case DLT_FUNC:
+			  ret = init_func(log, (DirectLogFunc) param);
+			   break;
      }
 
      if (ret)
@@ -172,7 +181,10 @@ direct_log_printf( DirectLog  *log,
 
           pthread_mutex_lock( &log->lock );
 
-          write( log->fd, buf, len );
+		  if ( log->func )
+			   log->func( buf, len );
+		  else
+			   write( log->fd, buf, len );
 
           pthread_mutex_unlock( &log->lock );
      }
@@ -394,3 +406,13 @@ init_udp( DirectLog  *log,
 
      return DR_OK;
 }
+
+static DirectResult
+init_func( DirectLog *log, DirectLogFunc func )
+{
+     log->fd = -1;
+	 log->func = func;
+
+     return DR_OK;
+}
+
diff -u -r -N -p DirectFB-1.2.0.orig/lib/direct/log.h DirectFB-1.2.0/lib/direct/log.h
--- DirectFB-1.2.0.orig/lib/direct/log.h	2008-06-02 07:07:44.000000000 +0100
+++ DirectFB-1.2.0/lib/direct/log.h	2008-10-06 16:09:16.001650118 +0100
@@ -32,13 +32,18 @@
 #include <direct/types.h>
 #include <direct/messages.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 typedef enum {
      DLT_STDERR,    /* Simply print out log on stderr. */
      DLT_FILE,      /* Write log into a file. */
-     DLT_UDP        /* Send out log via UDP. */
+     DLT_UDP,       /* Send out log via UDP. */
+	 DLT_FUNC,      /* Output through a function. */
 } DirectLogType;
 
+typedef void (*DirectLogFunc)(const char *, size_t len);
 
 /*
  * Creates a logging facility.
@@ -86,4 +91,8 @@ void         direct_log_unlock     ( Dir
  */
 DirectLog   *direct_log_default( void );
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
