| @@ -17,13 +17,13 @@ discard block | ||
| 17 | 17 | try | 
| 18 | 18 |  { | 
| 19 | 19 | |
| 20 | - $trap = new Trap($icingaweb2Etc); | |
| 21 | - //$Trap = new Trap($icingaweb2Etc,4,'display'); // For debug | |
| 22 | - //$Trap = new Trap($icingaweb2Etc,4,'syslog'); // For debug | |
| 23 | - //$Trap->setLogging(4,'syslog'); | |
| 20 | + $trap = new Trap($icingaweb2Etc); | |
| 21 | + //$Trap = new Trap($icingaweb2Etc,4,'display'); // For debug | |
| 22 | + //$Trap = new Trap($icingaweb2Etc,4,'syslog'); // For debug | |
| 23 | + //$Trap->setLogging(4,'syslog'); | |
| 24 | 24 | |
| 25 | - // TODO : tranfer this to reset_trap cli command | |
| 26 | - $trap->eraseOldTraps(); | |
| 25 | + // TODO : tranfer this to reset_trap cli command | |
| 26 | + $trap->eraseOldTraps(); | |
| 27 | 27 | |
| 28 | 28 |  	$trap->read_trap('php://stdin'); | 
| 29 | 29 | |
| @@ -36,15 +36,15 @@ discard block | ||
| 36 | 36 | } | 
| 37 | 37 | catch (Exception $e) | 
| 38 | 38 |  { | 
| 39 | - if ($trap == null) | |
| 40 | -    {  // Exception in trap creation : log in display & syslog | |
| 41 | - $logging = new Logging(); | |
| 42 | -        $logging->log("Caught exception creating Trap class",2); | |
| 43 | - } | |
| 44 | - else | |
| 45 | -    { | |
| 39 | + if ($trap == null) | |
| 40 | +	{  // Exception in trap creation : log in display & syslog | |
| 41 | + $logging = new Logging(); | |
| 42 | +		$logging->log("Caught exception creating Trap class",2); | |
| 43 | + } | |
| 44 | + else | |
| 45 | +	{ | |
| 46 | 46 |  	   $trap->trapLog("Exception : ". $e->getMessage(),2,0); | 
| 47 | - } | |
| 47 | + } | |
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | //end | 
| @@ -4,7 +4,7 @@ discard block | ||
| 4 | 4 | use Trapdirector\Trap; | 
| 5 | 5 | |
| 6 | 6 | // start | 
| 7 | -$time1 = microtime(true); | |
| 7 | +$time1=microtime(true); | |
| 8 | 8 | |
| 9 | 9 |  require_once ('trap_class.php'); | 
| 10 | 10 | |
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | try | 
| 18 | 18 |  { | 
| 19 | 19 | |
| 20 | - $trap = new Trap($icingaweb2Etc); | |
| 20 | + $trap=new Trap($icingaweb2Etc); | |
| 21 | 21 | //$Trap = new Trap($icingaweb2Etc,4,'display'); // For debug | 
| 22 | 22 | //$Trap = new Trap($icingaweb2Etc,4,'syslog'); // For debug | 
| 23 | 23 | //$Trap->setLogging(4,'syslog'); | 
| @@ -38,12 +38,12 @@ discard block | ||
| 38 | 38 |  { | 
| 39 | 39 | if ($trap == null) | 
| 40 | 40 |      {  // Exception in trap creation : log in display & syslog | 
| 41 | - $logging = new Logging(); | |
| 42 | -        $logging->log("Caught exception creating Trap class",2); | |
| 41 | + $logging=new Logging(); | |
| 42 | +        $logging->log("Caught exception creating Trap class", 2); | |
| 43 | 43 | } | 
| 44 | 44 | else | 
| 45 | 45 |      { | 
| 46 | -	   $trap->trapLog("Exception : ". $e->getMessage(),2,0); | |
| 46 | +	   $trap->trapLog("Exception : ".$e->getMessage(), 2, 0); | |
| 47 | 47 | } | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -33,15 +33,13 @@ | ||
| 33 | 33 | |
| 34 | 34 | $trap->add_rule_final(microtime(true) - $time1); | 
| 35 | 35 | |
| 36 | -} | |
| 37 | -catch (Exception $e) | |
| 36 | +} catch (Exception $e) | |
| 38 | 37 |  { | 
| 39 | 38 | if ($trap == null) | 
| 40 | 39 |      {  // Exception in trap creation : log in display & syslog | 
| 41 | 40 | $logging = new Logging(); | 
| 42 | 41 |          $logging->log("Caught exception creating Trap class",2); | 
| 43 | - } | |
| 44 | - else | |
| 42 | + } else | |
| 45 | 43 |      { | 
| 46 | 44 |  	   $trap->trapLog("Exception : ". $e->getMessage(),2,0); | 
| 47 | 45 | } |