diff --git a/inc/infoutils.php b/inc/infoutils.php
index 46bccf82f4f8e7a167ddbb9d52f39dae26085a20..ac59d94885b85da1395a2639f815c655eda15317 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -280,12 +280,14 @@ function dbg($msg,$hidden=false){
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
-function dbglog($msg){
+function dbglog($msg,$header=''){
   global $conf;
   if(is_object($msg) || is_array($msg)){
     $msg = print_r($msg,true);
   }
 
+  if($header) $msg = "$header\n$msg";
+
   $file = $conf['cachedir'].'/debug.log';
   $fh = fopen($file,'a');
   if($fh){