--- devel.module	2011-01-16 03:17:13.000000000 +0300
+++ devel.module.new	2011-02-01 16:05:28.000000000 +0300
@@ -1,5 +1,5 @@
 <?php
-// $Id: devel.module,v 1.473 2011/01/16 00:17:13 salvis Exp $
+// $Id: devel.module,v 1.472 2011/01/04 19:47:31 weitzman Exp $
 
 // This module holds functions useful for Drupal development.
 // Please contribute!
@@ -372,33 +372,18 @@ function devel_init() {
       // We want to include the class early so that anyone may call krumo() as needed. See http://krumo.sourceforge.net/
       has_krumo();
 
-      // See http://www.firephp.org/HQ/Install.htm
-      $path = NULL;
-      if (@include_once('fb.php')) {
-        // FirePHPCore is in include_path. Probably a PEAR installation.
-        $path = '';
-      }
-      elseif (module_exists('libraries')) {
-        // Support Libraries API - http://drupal.org/project/libraries
-        $firephp_path = libraries_get_path('FirePHPCore') . '/lib/FirePHPCore/';
-        $chromephp_path = libraries_get_path('chromephp');
-      }
-      else {
-        $firephp_path = './'. drupal_get_path('module', 'devel') .'/FirePHPCore/lib/FirePHPCore/';
-        $chromephp_path = './' . drupal_get_path('module', 'devel') .'/chromephp';
-      }
-
-      // include FirePHP if exists...
-      if (file_exists($firephp_path .'fb.php')) {
-        include_once $firephp_path .'fb.php';
-        include_once $firephp_path .'FirePHP.class.php';
-      }
-
-      // include ChromePHP if exists...
-      if (file_exists($chromephp_path . '/ChromePhp.php')) {
-        include_once $chromephp_path . '/ChromePhp.php';
-      }
+      // Search & include FirePHP library
 
+      @(include_once 'FirePHPCore/fb.php') || 
+      @(include_once 'fb.php') ||
+      module_exists('libraries') && @(include_once libraries_get_path('FirePHPCore') . '/lib/FirePHPCore/' . 'fb.php') ||
+      @(include_once './'. drupal_get_path('module', 'devel') .'/FirePHPCore/lib/FirePHPCore/' . 'fb.php');    
+
+      // Search & include ChromePhp library
+
+      @(include_once 'chromephp/ChromePhp.php') || 
+      module_exists('libraries') && @(include_once libraries_get_path('chromephp') . 'ChromePhp.php') ||
+      @(include_once './'. drupal_get_path('module', 'devel') .'/chromephp/' . 'ChromePhp.php');    
 
       // Add CSS for query log if should be displayed.
       if (variable_get('devel_query_display', 0)) {
@@ -464,7 +449,15 @@ function dfbt($label) {
  */
 function dcp() {
   if (class_exists('ChromePhp') && user_access('access devel information')) {
-    $args = func_get_args();
+
+    // reversing array of args since label goes last 
+    $args = array_reverse(func_get_args());
+
+    if (count($args) == 3) { // third argument is message type: warn, err 
+    	$type = array_shift($args);
+      array_push($args, $type);
+    }
+    // wrapping inside @ until ChromePhp stops raising PHP Warnings for its backtrace handling 
     call_user_func_array(array('ChromePhp', 'log'), $args);
   }
 }
@@ -493,6 +486,26 @@ function devel_watchdog(array $log_entry
         $type = FirePHP::LOG;
     }
   }
+  elseif (class_exists('ChromePhp') && !drupal_is_cli()) {
+    switch ($log_entry['severity']) {
+      case WATCHDOG_EMERGENCY:
+      case WATCHDOG_ALERT:
+      case WATCHDOG_CRITICAL:
+      case WATCHDOG_ERROR:
+        $type = 'ERROR';
+        break;
+      case WATCHDOG_WARNING:
+        $type = 'WARN';
+        break;
+      case WATCHDOG_NOTICE:
+      case WATCHDOG_INFO:
+        $type = 'LOG';
+        break;
+      case WATCHDOG_DEBUG:
+      DEFAULT:
+        $type = 'LOG';
+    }
+  }
   else {
     $type = 'watchdog';
   }
@@ -505,6 +518,7 @@ function devel_watchdog(array $log_entry
     $watchdog['link'] = $log_entry['link'];
   }
   dfb($watchdog, $type);
+  dcp($watchdog, $type);
 }
 
 function devel_set_handler($handler) {
