directing debug to error_log

This commit is contained in:
Klaus Leithoff 2008-12-09 14:02:17 +00:00
parent a6d7f0caf3
commit 5cf2da77fa

View File

@ -126,8 +126,8 @@ class SMTP {
"errno" => $errno, "errno" => $errno,
"errstr" => $errstr); "errstr" => $errstr);
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": $errstr ($errno)" . $this->CRLF; ": $errstr ($errno)" . $this->CRLF);
} }
return false; return false;
} }
@ -147,7 +147,7 @@ class SMTP {
// socket_set_timeout($this->smtp_conn, 0, 100000); // socket_set_timeout($this->smtp_conn, 0, 100000);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; error_log(__METHOD__."->". "SMTP -> FROM SERVER:" . $this->CRLF . $announce);
} }
return true; return true;
@ -176,7 +176,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 220) { if($code != 220) {
@ -185,7 +185,7 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -220,8 +220,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -238,8 +238,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -256,8 +256,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -277,8 +277,8 @@ class SMTP {
// hmm this is an odd situation... the socket is // hmm this is an odd situation... the socket is
// valid but we are not connected anymore // valid but we are not connected anymore
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> NOTICE:" . $this->CRLF . error_log(__METHOD__."->". "SMTP -> NOTICE:" . $this->CRLF .
"EOF caught while checking if connected"; "EOF caught while checking if connected");
} }
$this->Close(); $this->Close();
return false; return false;
@ -343,7 +343,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->". "SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 354) { if($code != 354) {
@ -352,8 +352,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -452,15 +452,15 @@ class SMTP {
"smtp_msg" => "(nothing)"); "smtp_msg" => "(nothing)");
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->". "SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -469,8 +469,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -508,7 +508,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -517,8 +517,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -583,7 +583,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER: " . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -592,8 +592,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -638,7 +638,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->". "SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 211 && $code != 214) { if($code != 211 && $code != 214) {
@ -647,8 +647,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -686,7 +686,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->". "SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -695,8 +695,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -728,7 +728,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -737,8 +737,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -772,7 +772,7 @@ class SMTP {
$byemsg = $this->get_lines(); $byemsg = $this->get_lines();
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $byemsg);
} }
$rval = true; $rval = true;
@ -786,8 +786,8 @@ class SMTP {
"smtp_rply" => substr($byemsg,4)); "smtp_rply" => substr($byemsg,4));
$rval = false; $rval = false;
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $e["error"] . ": " . error_log(__METHOD__."->"."SMTP -> ERROR: " . $e["error"] . ": " .
$byemsg . $this->CRLF; $byemsg . $this->CRLF);
} }
} }
@ -825,7 +825,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->". "SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250 && $code != 251) { if($code != 250 && $code != 251) {
@ -834,8 +834,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -869,7 +869,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -878,8 +878,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -918,7 +918,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -927,8 +927,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->"."SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -966,7 +966,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -975,8 +975,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -1014,7 +1014,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250) { if($code != 250) {
@ -1023,8 +1023,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -1048,7 +1048,7 @@ class SMTP {
$this->error = array("error" => "This method, TURN, of the SMTP ". $this->error = array("error" => "This method, TURN, of the SMTP ".
"is not implemented"); "is not implemented");
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; error_log(__METHOD__."->"."SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF);
} }
return false; return false;
} }
@ -1081,7 +1081,7 @@ class SMTP {
$code = substr($rply,0,3); $code = substr($rply,0,3);
if($this->do_debug >= 2) { if($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; error_log(__METHOD__."->"."SMTP -> FROM SERVER:" . $this->CRLF . $rply);
} }
if($code != 250 && $code != 251) { if($code != 250 && $code != 251) {
@ -1090,8 +1090,8 @@ class SMTP {
"smtp_code" => $code, "smtp_code" => $code,
"smtp_msg" => substr($rply,4)); "smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . error_log(__METHOD__."->". "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF; ": " . $rply . $this->CRLF);
} }
return false; return false;
} }
@ -1115,14 +1115,14 @@ class SMTP {
$data = ""; $data = "";
while($str = @fgets($this->smtp_conn,515)) { while($str = @fgets($this->smtp_conn,515)) {
if($this->do_debug >= 4) { if($this->do_debug >= 4) {
echo "SMTP -> get_lines(): \$data was \"$data\"" . error_log(__METHOD__."->"."SMTP -> get_lines(): \$data was \"$data\"" .
$this->CRLF; $this->CRLF);
echo "SMTP -> get_lines(): \$str is \"$str\"" . error_log(__METHOD__."->"."SMTP -> get_lines(): \$str is \"$str\"" .
$this->CRLF; $this->CRLF);
} }
$data .= $str; $data .= $str;
if($this->do_debug >= 4) { if($this->do_debug >= 4) {
echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; error_log(__METHOD__."->". "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF);
} }
// if the 4th character is a space then we are done reading // if the 4th character is a space then we are done reading
// so just break the loop // so just break the loop