本文整理汇总了PHP中eZLog::write方法的典型用法代码示例。如果您正苦于以下问题:PHP eZLog::write方法的具体用法?PHP eZLog::write怎么用?PHP eZLog::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZLog
的用法示例。
在下文中一共展示了eZLog::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeAudit
/**
* Writes $auditName with $auditAttributes as content
* to file name that will be fetched from ini settings by auditNameSettings() for logging.
*
* @param string $auditName
* @param array $auditAttributes
* @return bool
*/
static function writeAudit($auditName, $auditAttributes = array())
{
$enabled = eZAudit::isAuditEnabled();
if (!$enabled) {
return false;
}
$auditNameSettings = eZAudit::auditNameSettings();
if (!isset($auditNameSettings[$auditName])) {
return false;
}
$ip = eZSys::clientIP();
if (!$ip) {
$ip = eZSys::serverVariable('HOSTNAME', true);
}
$user = eZUser::currentUser();
$userID = $user->attribute('contentobject_id');
$userLogin = $user->attribute('login');
$message = "[{$ip}] [{$userLogin}:{$userID}]\n";
foreach (array_keys($auditAttributes) as $attributeKey) {
$attributeValue = $auditAttributes[$attributeKey];
$message .= "{$attributeKey}: {$attributeValue}\n";
}
$logName = $auditNameSettings[$auditName]['file_name'];
$dir = $auditNameSettings[$auditName]['dir'];
eZLog::write($message, $logName, $dir);
return true;
}
示例2: __construct
/**
* @param int $objectID ContentObjectID
*/
public function __construct($objectID)
{
$userID = eZUser::currentUserID();
$message = ezpI18n::tr('design/standard/error/kernel', 'Access denied') . '. ' . ezpI18n::tr('design/standard/error/kernel', 'You do not have permission to access this area.');
eZLog::write("Access denied to content object #{$objectID} for user #{$userID}", 'error.log');
parent::__construct($message);
}
示例3: logMessage
/**
* Generic method for logging a message
*
* @param string $msg
* @param bool $bPrintMsg
* @param string $logType
*/
public static function logMessage($msg, $bPrintMsg = true, $logType = self::NOTICELOG)
{
switch ($logType) {
case self::ERRORLOG:
$logFile = self::ERRORLOG_FILE;
if ($bPrintMsg) {
self::writeError($msg);
}
break;
case self::WARNINGLOG:
$logFile = self::WARNINGLOG_FILE;
if ($bPrintMsg) {
self::writeWarning($msg);
}
break;
case self::NOTICELOG:
default:
$logFile = self::NOTICELOG_FILE;
if ($bPrintMsg) {
self::writeNotice($msg);
}
break;
}
eZLog::write($msg, $logFile);
}
示例4: write_invalid_checkcreditcard_log
public static function write_invalid_checkcreditcard_log($order_id, $response = array("errorcode" => "unknown", "errormessage" => "unknown"))
{
$http = eZHTTPTool::instance();
//set fallbacks for direct ajax request
if (!isset($order_id) or is_array($order_id) and count($order_id) == 0) {
$order_id = $http->postVariable('order_id');
}
if (!isset($response) or is_array($response) and count($response) == 0) {
$response = $http->postVariable('response');
}
eZLog::write("FAILED in step 1 ('checkcreditcard') for order ID " . $order_id . " with ERRORCODE " . $response["errorcode"] . " Message: " . $response["errormessage"], $logName = 'xrowpayone.log', $dir = 'var/log');
}
示例5: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
switch ($operatorName) {
case 'hashcreate':
$algorithm = $namedParameters['algorithm'];
$hash_array = $namedParameters['hash_array'];
$key = $namedParameters['key'];
$operatorValue = xrowPayoneHelper::generate_hash($algorithm, $hash_array, $key);
break;
case 'payone_info_by_order':
$order = $namedParameters['order'];
$payone_info = array();
if ($order instanceof eZOrder) {
$doc = new DOMDocument('1.0', 'utf-8');
$doc->loadXML($order->DataText1);
//try to fetch txid
$txid_element = $doc->getElementsByTagName('txid');
if ($txid_element->length >= 1) {
$payone_info["txid"] = (string) $txid_element->item(0)->nodeValue;
}
//try to fetch txid
$truncatedcardpan_element = $doc->getElementsByTagName('truncatedcardpan');
if ($txid_element->length >= 1) {
$payone_info["truncatedcardpan"] = (string) $truncatedcardpan_element->item(0)->nodeValue;
}
//try to fetch userid
$userid_element = $doc->getElementsByTagName('userid');
if ($userid_element->length >= 1) {
$payone_info["userid"] = (string) $userid_element->item(0)->nodeValue;
}
//try to fetch 3d secure payment status
$cc3d_reserved_element = $doc->getElementsByTagName('cc3d_reserved');
if ($cc3d_reserved_element->length >= 1) {
$payone_info["cc3d_reserved"] = (string) $cc3d_reserved_element->item(0)->nodeValue;
}
//try to fetch the paymentgateway
$paymentmethod_element = $doc->getElementsByTagName('paymentmethod');
if ($paymentmethod_element->length >= 1) {
$payone_info["paymentmethod"] = (string) $paymentmethod_element->item(0)->nodeValue;
}
} else {
eZLog::write("\$order is not an instance of eZOrder in extension/xrowpayone/autoloads/xrowpayoneoperator.php", $logName = 'xrowpayone.log', $dir = 'var/log');
}
if (count($payone_info) == 0) {
$operatorValue = false;
} else {
$operatorValue = $payone_info;
}
break;
}
}
示例6: generateCustomErrorString
public function generateCustomErrorString($order, $response)
{
$payoneINI = eZINI::instance('xrowpayone.ini');
$custom_error_node_id = $payoneINI->variable('GeneralSettings', 'CustomErrorNode');
$error_fallback = $payoneINI->variable('GeneralSettings', 'CustomErrorFallback');
$error_fallback = ezpI18n::tr('extension/xrowpayone', $error_fallback);
if ($custom_error_node_id !== "disabled") {
if (is_numeric($custom_error_node_id)) {
$custom_error_node = eZContentObjectTreeNode::fetch($custom_error_node_id);
if (isset($custom_error_node) and $custom_error_node instanceof eZContentObjectTreeNode) {
$error_code = $response["errorcode"];
$data_map = $custom_error_node->dataMap();
$matrix_identifier = $payoneINI->variable('GeneralSettings', 'CustomErrorNodeMatrixIdentifier');
if (isset($data_map[$matrix_identifier])) {
$matrix_attribute_content = $data_map[$matrix_identifier]->content();
$matrix_data = $matrix_attribute_content->Matrix;
$matrix_rows = $matrix_data["rows"];
$matrix_rows = $matrix_rows["sequential"];
foreach ($matrix_rows as $row) {
//now map the error code to the matrix code
if ($row["columns"]["0"] == $error_code) {
$custom_errormessage = $row["columns"]["1"];
//return the translated code from object
return $custom_errormessage;
}
}
} else {
eZLog::write("No attribute identifier named " . $matrix_identifier . " found. Please check your configuration 'xrowpayone.ini', GeneralSettings', 'CustomErrorNode'", $logName = 'xrowpayone.log', $dir = 'var/log');
}
} else {
eZLog::write("Could not fetch node from settings 'xrowpayone.ini', GeneralSettings', 'CustomErrorNode' please check your configuration", $logName = 'xrowpayone.log', $dir = 'var/log');
}
}
}
//the worst fallback
return $error_fallback;
}
示例7: checkCacheGenerationTimeout
/**
* Checks if the .generating file was changed, which would mean that generation
* timed out. If not timed out, refreshes the timestamp so that storage won't
* be stolen
*/
public function checkCacheGenerationTimeout()
{
clearstatcache();
// file_exists = false: another process stole the lock and finished the generation
// filemtime != stored one: another process is generating the file
if ( !file_exists( $this->filePath ) or ( @filemtime( $this->filePath ) != $this->generationStartTimestamp ) )
{
eZDebugSetting::writeDebug( 'kernel-clustering', "'$this->filePath' was changed during generation, looks like a generation timeout", __METHOD__ );
eZLog::write( "Generation of '$this->filePath' timed out", 'cluster.log' );
return false;
}
else
{
$mtime = time();
touch( $this->filePath, $mtime, $mtime );
return true;
}
}
示例8: exception
public static function exception($object, $exception, $section = false)
{
if (self::ERROR <= self::$level)
{
$msg = sprintf('[Exception] %s on line %s in %s', $exception->getMessage(), $exception->getLine(), $exception->getFile());
eZLog::write(self::parse($object, $msg, $section) . '\n' . $exception->getTraceAsString(), self::$logname);
if (self::$cli)
{
self::$cli->error(self::parse($object, $msg, $section));
}
MMSynchMonitor::inc(MMSynchMonitor::EXCEPTION);
}
self::startSection($section);
}
示例9: startCacheGeneration
/**
* Starts cache generation for the current file.
*
* This is done by creating a file named by the original file name, prefixed
* with '.generating'.
*
* @return bool false if the file is being generated, true if it is not
**/
public function startCacheGeneration()
{
$generatingFilePath = $this->filePath . '.generating';
$ret = $this->backend->_startCacheGeneration($this->filePath, $generatingFilePath);
// generation granted
if ($ret['result'] == 'ok') {
$this->realFilePath = $this->filePath;
$this->filePath = $generatingFilePath;
$this->generationStartTimestamp = $ret['mtime'];
return true;
} elseif ($ret['result'] == 'ko') {
return $ret['remaining'];
} else {
eZLog::write("An error occured starting cache generation on '{$generatingFilePath}'", 'cluster.log');
return false;
}
}
示例10: fileLog
/**
* Writes a file log (severity below warning)
* @param string $message Message to log
* @param string $severity Severity of the log message
*/
protected static function fileLog($message, $severity)
{
if (!empty(self::$file))
{
$messages = explode("\n", $message);
foreach ($messages as $index => $m)
{
$messages[$index] = 'F : ' . self::$file . ' - P : ' . self::$publisher . " | $m";
}
}
else
return;
$index = array_search($severity, self::$severities);
if ($index >= self::$reportLevel)
{
foreach ($messages as $message)
{
eZLog::write($message, self::$prefixLog . "$severity.log");
}
}
}
示例11: create
//.........这里部分代码省略.........
unset( $params[$key] );
}
if( !empty( $availableDateParams ) && isset( $availableDateParams[$key] ) && !empty($value) )
{
$params[$key] = $this->convertDateforUUMP( $value, $formatDate );
}
if( !empty( $skipParametersIfEmptyValue ) && isset( $skipParametersIfEmptyValue[$key] ) && empty($value) )
{
unset( $params[$key] );
}
}
$parameters['data']['profile'] = array_merge( $parameters['data']['profile'], $params );
$sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_locale' );
if ( !is_null( $sl ) )
{
$parameters['data']['profile']['locale'] = $sl;
}
}
else
{
$parameters = array(
'Data' => array_merge( $unifiedParameters, array( 'Params' => $params ) ),
'cr' => $this->getCountryOfRegistration()
);
}
//LOG for locale field UUMP #36428
if ( $this instanceof ServiceUserUUMP )
{
if( empty( $parameters['data']['profile']['locale'] ) )
{
$errorLocalMsg = "\n\nEMPTY LOCALE:\nVALUES: " . json_encode( $parameters );
\eZLog::write( $errorLocalMsg, 'esb_uump_locale.log');
}
}
$result = $this->callWSHandler( $this->getEsbInterface( 'create' ), $parameters );
if( SolrSafeOperatorHelper::featureIsActive('RegistrationAutologin') && SolrSafeOperatorHelper::feature('RegistrationAutologin', 'DisallowPendingUsers') == true && !isset( $_POST['register-helpdesk'] ))
{
if( $result['data']['profile']['validationStatus'] == 'PV' )
{
$result['RedirectPending'] = true;
$result['RedirectPendingHref'] = eZINI::instance( 'site.ini' )->variable( 'SiteSettings', 'PendingUserStaticPage' );
return $result;
}
}
// if the registration was successful, we need to log the user on eZ + Backend side too
if ( $this instanceof ServiceUserUUMP )
{
$noErrorOnCreate = ( isset( $result['data']['errorCode'] ) && $result['data']['errorCode'] == 0 );
}
else
{
$noErrorOnCreate = ( isset( $result['Data']['ErrorCode'] ) && $result['Data']['ErrorCode'] == 0 );
}
if ( $noErrorOnCreate )
{
$allowRedirect = false;
$availableRedirectContext = SolrSafeOperatorHelper::feature( 'RegistrationSettings', 'AvailableContextList' );
$context = $_POST['context'] != '' ? $_POST['context'] : null;
if ( $context !== null && !empty( $availableRedirectContext ) )
{
示例12: callLyris
/**
* @param string $type
* @param string $uumpId
* @param bool|string $email
* @param bool|string $url
* @throws Exception
*/
protected function callLyris($type, $uumpId, $email = false, $url = false)
{
$serviceUrl = self::buildUrl($type, $uumpId, $url);
eZLog::write("Email for URL: {$email}", 'resetpass.log');
eZLog::write("Service URL: {$url}", 'resetpass.log');
$response = eZHTTPTool::getDataByURL($serviceUrl);
eZLog::write("EMAILSERVICE URL: {$serviceUrl}", 'esb_uump.log');
eZLog::write("EMAILSERVICE RESPONSE:\n" . $response, 'esb_uump.log');
eZLog::write("EMAILSERVICE URL: {$serviceUrl}", 'resetpass.log');
eZLog::write("EMAILSERVICE RESPONSE:\n" . $response, 'resetpass.log');
}
示例13: startCacheGeneration
/**
* Starts cache generation for the current file.
*
* This is done by creating a file named by the original file name, prefixed
* with '.generating'.
*
* @return bool false if the file is being generated, true if it is not
*/
public function startCacheGeneration()
{
eZDebugSetting::writeDebug('kernel-clustering', "Starting cache generation", "dfs::startCacheGeneration( '{$this->filePath}' )");
$generatingFilePath = $this->filePath . '.generating';
try {
$ret = self::$dbbackend->_startCacheGeneration($this->filePath, $generatingFilePath);
} catch (RuntimeException $e) {
eZDebug::writeError($e->getMessage());
return false;
}
// generation granted
if ($ret['result'] == 'ok') {
eZClusterFileHandler::addGeneratingFile($this);
$this->realFilePath = $this->filePath;
$this->filePath = $generatingFilePath;
$this->generationStartTimestamp = $ret['mtime'];
return true;
} elseif ($ret['result'] == 'ko') {
return $ret['remaining'];
} else {
eZLog::write("An error occured starting cache generation on '{$generatingFilePath}'", 'cluster.log');
return false;
}
}
示例14: addTranslationIfNotExist
/**
* @desc Add the new translation found in the existing file of translation
* @author David LE RICHE <david.leriche@openwide.fr>
* @params string $file => the file where the translation is adding
* @return bool
* @copyright 2012
* @version 1.1
*/
public function addTranslationIfNotExist($file)
{
$tsFile = new DOMDocument();
$tsFile->load($file);
$xpath = new DOMXpath($tsFile);
$ts = $tsFile->documentElement;
foreach ($this->tabKey as $sourceName => $tabElement) {
foreach ($tabElement as $element) {
$query = "//context[name=" . (strpos($sourceName, "'") === false ? "'{$sourceName}'" : "\"{$sourceName}\"") . "]/message[source=" . (strpos($element, "'") === false ? "'{$element}'" : "\"{$element}\"") . "]";
try {
if ($xpath->query($query) && !$xpath->query($query)->item(0)) {
$querySourceName = "//context[name=" . (strpos($sourceName, "'") === false ? "'{$sourceName}'" : "\"{$sourceName}\"") . "]";
//create context if not exists
if (!$xpath->query($querySourceName)->item(0)) {
$context = $tsFile->createElement('context');
$ts->appendChild($context);
$name = $tsFile->createELement('name', $sourceName);
$context->appendChild($name);
} else {
$context = $xpath->query($querySourceName)->item(0);
}
$message = $tsFile->createElement('message');
$context->appendChild($message);
$source = $tsFile->createElement('source', htmlspecialchars($element));
$message->appendChild($source);
$translation = $tsFile->createElement('translation');
$message->appendChild($translation);
}
} catch (Exception $e) {
eZLog::write($e, 'owtranslate.log');
}
}
}
try {
if ($unlinkFile = unlink($file)) {
$saveXml = $tsFile->save($file, LIBXML_NOEMPTYTAG);
}
} catch (exception $e) {
echo $e;
}
return $saveXml;
}
示例15: handleError
/**
* Runs the defined error module
* Sets the state of the module object to \c failed and sets the error code.
*
* @param mixed $errorCode
* @param mixed $errorType
* @param array $parameters
* @param mixed $userParameters
*
* @see setErrorModule(), errorModule()
*/
function handleError( $errorCode, $errorType = false, $parameters = array(), $userParameters = false )
{
if ( !$errorType )
{
eZDebug::writeWarning( "No error type specified for error code $errorCode, assuming kernel.\nA specific error type should be supplied, please check your code.", __METHOD__ );
$errorType = 'kernel';
}
$errorModule = $this->errorModule();
$module = eZModule::findModule( $errorModule['module'], $this );
if ( $module === null )
{
return false;
}
if ( $errorCode == eZError::KERNEL_ACCESS_DENIED )
{
eZLog::setMaxLogSize( 10 * 1024 * 1024 );
eZLog::write("Request : " . var_export($_REQUEST, true), 'access_denied.log');
eZLog::write('Server : ' . var_export($_SERVER, true), 'access_denied.log');
eZLog::write("Env : " . var_export($_ENV, true), 'access_denied.log');
}
elseif ( $errorCode == eZError::KERNEL_MODULE_NOT_FOUND )
{
eZLog::setMaxLogSize( 10 * 1024 * 1024 );
eZLog::write("Request : " . var_export($_REQUEST, true), 'module_not_found.log');
eZLog::write('Server : ' . var_export($_SERVER, true), 'module_not_found.log');
eZLog::write("Env : " . var_export($_ENV, true), 'module_not_found.log');
}
$result = $module->run( $errorModule['view'], array( $errorType, $errorCode, $parameters, $userParameters ) );
// The error module may want to redirect to another URL, see error.ini
if ( $this->exitStatus() != eZModule::STATUS_REDIRECT and
$this->exitStatus() != eZModule::STATUS_RERUN )
{
$this->setExitStatus( eZModule::STATUS_FAILED );
$this->setErrorCode( $errorCode );
}
return $result;
}