本文整理汇总了PHP中Log::Log方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::Log方法的具体用法?PHP Log::Log怎么用?PHP Log::Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::Log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* make new translate
*/
protected function __construct()
{
$options = array('log' => Log::Log(), 'logUntranslated' => false);
$locale = L10n::getInstance();
$supported = $locale->getBrowser();
arsort($supported, SORT_NUMERIC);
$file = '';
foreach ($supported as $loc => $val) {
if (file_exists(LOCALE_PATH . '/' . $loc . '/locale.php')) {
$file = LOCALE_PATH . '/' . $loc . '/locale.php';
$locale->setLocale($loc);
break;
}
}
if ($file == '' && file_exists(LOCALE_PATH . '/en_US/locale.php')) {
$file = LOCALE_PATH . '/en_US/locale.php';
$locale->setLocale('en_US');
}
if ($file != '') {
$this->translate = new Zend_Translate(Zend_Translate::AN_ARRAY, $file, $locale->getLanguage(), $options);
#Log::Log()->debug('locale ' . $locale->getLanguage() . '_' .$locale->getRegion() . ' loaded');
} else {
throw new Exception(__METHOD__ . ': no translation files available');
}
}
示例2: OnStartForking
public function OnStartForking()
{
Log::Log("Starting 'CleanZombyUsers' cronjob...", E_USER_NOTICE);
$db = Core::GetDBInstance();
$this->ThreadArgs = array();
foreach((array)$db->GetAll("SELECT * FROM users") as $user)
{
$domains = $db->GetOne("SELECT COUNT(*) FROM domains WHERE status='".DOMAIN_STATUS::DELEGATED."' AND userid='{$user['id']}'");
$invoices = $db->GetOne("SELECT COUNT(*) FROM invoices WHERE (status='1' OR (status = '0'
AND TO_DAYS(NOW())-TO_DAYS(dtcreated)<15)) AND userid='{$user['id']}'
");
if ($domains == 0 && $invoices == 0)
{
Log::Log("Found inactive user: {$user['login']} (id = {$user['id']})", E_USER_NOTICE);
$db->Execute("DELETE FROM users WHERE id='{$user['id']}'");
$db->Execute("DELETE FROM invoices WHERE userid='{$user['id']}'");
$db->Execute("DELETE FROM domains WHERE userid='{$user['id']}'");
$db->Execute("DELETE FROM contacts WHERE userid='{$user['id']}'");
}
}
}
示例3: StartThread
public function StartThread($module_info)
{
// Reopen database connection in child process
$db = Core::GetDBInstance(null, true);
// Attach mail notifications on registy events
Registry::AttachClassObserver(new EmailToRegistrantObserver());
Registry::AttachClassObserver(new OperationHistory());
Registry::AttachClassObserver(new ManagedDNSRegistryObserver());
$RegFactory = RegistryModuleFactory::GetInstance();
$Registry = $RegFactory->GetRegistryByName($module_info["name"], false);
$Extensions = $Registry->GetManifest()->GetExtensionList();
foreach ($Extensions as $ext)
{
try
{
$r = false;
$r = $RegFactory->GetRegistryByExtension($ext, true, true);
}
catch(Exception $e)
{
$r = false;
}
if ($r && $r->GetModuleName() == $Registry->GetModuleName())
{
Log::Log(sprintf("Processing %s extension with module %s", $ext, $r->GetModuleName()), E_USER_NOTICE);
$r->DispatchPendingOperations();
}
}
}
示例4: __construct
/**
* Constructor
* @access public
* @return void
*/
function __construct($message, $code = 0)
{
parent::__construct($message, $code);
// Add log entry
Log::Log($code == 0 ? "Error: " : "Warning: " . $this->getMessage());
redirect(CF_ROUTER_URL . "/error.php?msg=" . urlencode($message));
}
示例5: OnStartForking
public function OnStartForking()
{
// Initialization
$Db = Core::GetDBInstance();
$DbDomain = DBDomain::GetInstance();
$Whois = JWhois::GetInstance();
// Grep TLDs
$data = $Db->GetAll("SELECT TLD FROM tlds WHERE modulename = 'Verisign' AND isactive = 1");
foreach ($data as $row) {
$tlds[] = "'{$row['TLD']}'";
}
$tlds = join(',', $tlds);
// Grep domains
$domain_data = $Db->GetAll("\r\n\t\t\t\tSELECT name, TLD FROM domains \r\n\t\t\t\tWHERE\r\n\t\t\t\t-- TLD in matching list\r\n\t\t\t\tTLD IN ({$tlds})\r\n\t\t\t\t-- Today is anniversary of registration\r\n\t\t\t\tAND ((MONTH(NOW()) = MONTH(start_date) AND DAY(NOW()) = DAY(start_date))\r\n\t\t\t\t-- Today is 28/02 and domain was registered 29/02 at leap year \r\n\t\t\t\tOR (MONTH(NOW()) = 2 AND DAY(NOW()) = 28 AND MONTH(start_date) = 2 AND DAY(start_date) = 29))\r\n\t\t\t");
foreach ($domain_data as $row) {
try {
$Domain = $DbDomain->LoadByName($row['name'], $row['TLD']);
$Client = Client::Load($Domain->UserID);
// Send notice
$emlvars = array('whois' => $Whois->Whois($Domain->GetHostName()), 'Client' => $Client);
mailer_send("wdrp_notice.eml", $emlvars, $Client->Email, $Client->Name);
} catch (Exception $e) {
Log::Log(sprintf("Failed to sent notice about %s. %s", "{$row['name']}.{$row['TLD']}", $e->getMessage()), E_ERROR);
}
}
}
示例6: DoExchange
private function DoExchange($message)
{
if (class_exists("HttpRequest") && !$this->curl) {
if (!$this->http_request) {
$this->http_request = new HttpRequest();
}
$http_request = $this->http_request;
$http_request->setUrl($this->url);
$http_request->setMethod(HTTP_METH_POST);
$http_request->setRawPostData($message);
$http_message = $http_request->send();
if ($http_message->getResponseCode() == 200) {
return $http_message->getBody();
} else {
throw new Exception(sprintf("Service failed with code = %d, message: %s", $http_message->getResponseCode(), $http_message->getBody()));
}
} else {
if (!$this->curl) {
$this->curl = curl_init();
}
curl_setopt_array($this->curl, array(CURLOPT_URL => $this->url, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $message, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0));
$http_body = curl_exec($this->curl);
if ("200" == ($status = curl_getinfo($this->curl, CURLINFO_HTTP_CODE))) {
return $http_body;
} else {
if ($err = curl_error($this->curl)) {
Log::Log("CURL error: {$err}", E_USER_NOTICE);
}
throw new Exception(sprintf("Service failed with code = %d, message: %s", $status, $http_body));
}
}
}
示例7: indexAction
public function indexAction()
{
$session = Zend_Registry::get('session');
Log::Log()->info(__METHOD__ . ' user logged out ' . $this->view->session->authdata['authed_username']);
unset($session->authdata);
$session->authdata['authed'] = false;
Zend_Session::destroy();
}
示例8: IsExtensionLicensed
public static final function IsExtensionLicensed($extension_name)
{
try {
return self::IsFlagEnabled($extension_name);
} catch (Exception $ex) {
Log::Log("Unknown extension {$extension_name}. Considering it a custom one (licensed).", E_USER_NOTICE);
return true;
}
}
示例9: Request
/**
* This method performs request to remote registry
*
* @param string $command Registry command
* @param array $data Command dependent data
* @return TransportResponse
*/
function Request($command, $data = array())
{
$data["Command"] = $command;
$data['UID'] = $this->Login;
$data['PW'] = $this->Password;
$data['responsetype'] = 'xml';
$request = http_build_query($data);
Log::Log(sprintf("Sending request: %s", $request), E_USER_NOTICE);
if ($this->DumpTraffic) {
print ">> Sending request:\n";
print "{$request}\n";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_URL, $this->ServerHost);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$retval = @curl_exec($ch);
$e = curl_error($ch);
curl_close($ch);
// Log response
Log::Log(sprintf("Server response:\n%s", $retval), E_USER_NOTICE);
if ($this->DumpTraffic) {
print "<< Server respond:\n";
print "{$retval}\n";
}
if ($e) {
throw new Exception($e);
}
// Remove unparsable characters, to prevent "PCDATA invalid Char value" error
$retval = preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/', '', $retval);
// Construct XML object
$Response = new SimpleXMLElement($retval);
if (!$Response) {
throw new Exception(_("Registry returned malformed XML"));
}
if ($Response->ErrCount > 0) {
$errmsg = (string) $Response->errors->Err1;
}
if ($Response->RRPCode) {
$response_code = (int) $Response->RRPCode;
// Succes when no error messages and RRP code is successful
$is_success = !$errmsg && ((int) $response_code >= 200 && (int) $response_code <= 220);
if (!$is_success && !$errmsg) {
// Set error message
$errmsg = $Response->RRPText;
}
} else {
$response_code = 1;
$is_success = !$errmsg;
}
return new TransportResponse($response_code, $Response, $is_success, $errmsg);
}
示例10: OnStartForking
public function OnStartForking()
{
Log::Log("Starting 'LogRotate' cronjob...", E_USER_NOTICE);
$db = Core::GetDBInstance();
$this->ThreadArgs = array();
if (CONFIG::$ROTATE_LOG_EVERY > 0)
$db->Execute("DELETE FROM syslog WHERE TO_DAYS(NOW())-TO_DAYS(dtadded) > ?", array(CONFIG::$ROTATE_LOG_EVERY));
}
示例11: dispatchLoopStartup
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$session = Zend_Registry::get('session');
if (in_array($request->getControllerName(), array('login', 'error', 'js', 'img', 'css'))) {
return;
}
if (!isset($session->authdata) || !isset($session->authdata['authed']) || $session->authdata['authed'] === false) {
$fc = Zend_Controller_Front::getInstance();
$response = $fc->getResponse();
$response->canSendHeaders(true);
$response->setHeader('Location', 'login', true);
$response->setHeader('Status', '301', true);
Log::Log()->debug('redirected to login');
$request->setModuleName('default')->setControllerName('login')->setActionName('index')->setDispatched(false);
}
}
示例12: OnPaid
public function OnPaid(Invoice $Invoice, AbstractPaymentModule $payment_module = null)
{
if ($Invoice->Purpose != INVOICE_PURPOSE::BALANCE_DEPOSIT) {
return;
}
Log::Log("BalanceInvoiceObserver::OnPaid(InvoiceID={$Invoice->ID})", E_USER_NOTICE);
try {
$Balance = DBBalance::GetInstance()->LoadClientBalance($Invoice->UserID);
$Operation = $Balance->CreateOperation(BalanceOperationType::Deposit, $Invoice->GetTotal());
$Operation->InvoiceID = $Invoice->ID;
$Balance->ApplyOperation($Operation);
} catch (Exception $e) {
Log::Log("BalanceInvoiceObserver::OnPaid() thrown exception: {$e->getMessage()}", E_USER_ERROR);
}
// OnPaymentComplete routine succeffully completed.
Log::Log("BalanceInvoiceObserver::OnPaid Successfully completed.", E_USER_NOTICE);
}
示例13: GetSpeedScore
/**
* Return Server Score calculated from ping time and server connection time
*
* @param string $server Server hostname
* @return float
*/
public function GetSpeedScore($server)
{
$ping = round($this->GetPingSpeed($server),2);
$connect = round($this->GetNNTPSpeed($server),2);
if (Log::HasLogger("PCNTL"))
Log::Log("Server score for '{$server}': ping={$ping}, connect={$connect}", 1, "PCNTL");
else
Log::Log("Server score for '{$server}': ping={$ping}, connect={$connect}", 1, "NNTPLog");
if ($connect)
{
$total = round(($ping+$connect)/2, 2);
return $total;
}
else
return false;
}
示例14: __construct
/**
* A cow
*
* @param string $message
* @param int $code One of PHP's internal E_
*/
function __construct($message, $code = null)
{
// Defaultize $code. Not sure if we can place a constant in param default, since constants are kind of late-binded
$code = ($code == null) ? E_USER_ERROR : $code;
// Call Exception constructor
parent::__construct($message, $code);
// Generate backtrace if debug mode flag set
if (CONFIG::$DEV_DEBUG)
$this->BackTrace = Debug::Backtrace();
// Log exception
if ( class_exists("Log") && Log::HasLogger("EPPDRSLogger"))
{
Log::$DoRaiseExceptions = false;
Log::Log("{$this->getMessage()}", $code, array("backtrace" => $bt), "EPPDRSLogger");
}
}
示例15: Notify
public function Notify(AbstractPaymentModule $PaymentModule, $status)
{
Log::Log("UIPaymentObserver: received notify", E_USER_NOTICE);
if ($status == PAYMENT_STATUS::SUCCESS)
{
$GLOBALS["okmsg"] = _("Thank you for your payment!");
if (!$_SESSION["success_payment_redirect_url"])
CoreUtils::Redirect("inv_view.php");
else
CoreUtils::Redirect($_SESSION["success_payment_redirect_url"]);
}
elseif ($status == PAYMENT_STATUS::FAILURE)
{
$PaymentForm = $PaymentModule->GetPaymentForm();
$smarty = Core::GetSmartyInstance("SmartyExt");
$fields = $PaymentForm->ListFields();
$smarty_fields = array();
foreach($fields as $field)
{
$smarty_fields[$field->Title] = array("name" => $field->Name, "required" => $field->IsRequired, "type" => $field->FieldType, "values" => $field->Options);
if ($_REQUEST[$field->Name])
$attr[$field->Title] = $_REQUEST[$field->Name];
}
$display["errmsg"] = "The following errors occured";
$display["err"] = explode("\n", $PaymentModule->GetFailureReason());
$display["gate"] = $PaymentModule->GetModuleName();
$display["orderid"] = $PaymentModule->GetOrderID(false);
$display["fields"] = $smarty_fields;
$display["post"] = $attr;
$template_name = "client/paymentdata.tpl";
$smarty->assign($GLOBALS["display"]);
$smarty->assign($display);
$smarty->display($template_name);
}
else
throw new Exception(sprintf(_("Undefined PaymentStatus received from %s payment module."), $PaymentModule->GetModuleName()), E_USER_ERROR);
}