本文整理汇总了PHP中common_Logger::e方法的典型用法代码示例。如果您正苦于以下问题:PHP common_Logger::e方法的具体用法?PHP common_Logger::e怎么用?PHP common_Logger::e使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_Logger
的用法示例。
在下文中一共展示了common_Logger::e方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run(Task $task)
{
\common_Logger::d('Running task ' . $task->getId());
$report = new \common_report_Report(\common_report_Report::TYPE_INFO, __('Running task %s', $task->getId()));
$queue = $this->getServiceLocator()->get(Queue::CONFIG_ID);
$queue->updateTaskStatus($task->getId(), Task::STATUS_RUNNING);
try {
$actionService = $this->getServiceLocator()->get(ActionService::SERVICE_ID);
$invocable = $task->getInvocable();
if (is_string($invocable)) {
$invocable = $actionService->resolve($task->getInvocable());
} else {
if ($invocable instanceof ServiceLocatorAwareInterface) {
$invocable->setServiceLocator($this->getServiceLocator());
}
}
$subReport = call_user_func($invocable, $task->getParameters());
$report->add($subReport);
} catch (\Exception $e) {
$message = 'Task ' . $task->getId() . ' failed. Error message: ' . $e->getMessage();
\common_Logger::e($message);
$report = new \common_report_Report(\common_report_Report::TYPE_ERROR, $message);
}
$queue->updateTaskStatus($task->getId(), Task::STATUS_FINISHED, $report);
return $report;
}
示例2: testFileAppender
public function testFileAppender()
{
$tfile = $this->createFile();
$dfile = $this->createFile();
$efile = $this->createFile();
common_log_Dispatcher::singleton()->init(array(array('class' => 'SingleFileAppender', 'threshold' => common_Logger::TRACE_LEVEL, 'file' => $tfile), array('class' => 'SingleFileAppender', 'mask' => 2, 'file' => $dfile), array('class' => 'SingleFileAppender', 'threshold' => common_Logger::ERROR_LEVEL, 'file' => $efile)));
common_Logger::singleton()->enable();
common_Logger::t('message');
$this->assertEntriesInFile($tfile, 1);
$this->assertEntriesInFile($dfile, 0);
$this->assertEntriesInFile($efile, 0);
common_Logger::d('message');
$this->assertEntriesInFile($tfile, 2);
$this->assertEntriesInFile($dfile, 1);
$this->assertEntriesInFile($efile, 0);
common_Logger::e('message');
$this->assertEntriesInFile($tfile, 3);
$this->assertEntriesInFile($dfile, 1);
$this->assertEntriesInFile($efile, 1);
common_Logger::singleton()->disable();
common_Logger::d('message');
$this->assertEntriesInFile($tfile, 3);
$this->assertEntriesInFile($dfile, 1);
$this->assertEntriesInFile($efile, 1);
common_Logger::singleton()->restore();
common_Logger::d('message');
$this->assertEntriesInFile($tfile, 4);
$this->assertEntriesInFile($dfile, 2);
$this->assertEntriesInFile($efile, 1);
common_Logger::singleton()->restore();
}
示例3: outputFile
public static function outputFile($relPath, $filename = null)
{
$fullpath = self::getExportPath() . DIRECTORY_SEPARATOR . $relPath;
if (tao_helpers_File::securityCheck($fullpath, true) && file_exists($fullpath)) {
Context::getInstance()->getResponse()->setContentHeader(tao_helpers_File::getMimeType($fullpath));
$fileName = empty($filename) ? basename($fullpath) : $filename;
header('Content-Disposition: attachment; fileName="' . $fileName . '"');
header("Content-Length: " . filesize($fullpath));
//Clean all levels of output buffering
while (ob_get_level() > 0) {
ob_end_clean();
}
flush();
$fp = fopen($fullpath, "r");
if ($fp !== false) {
while (!feof($fp)) {
echo fread($fp, 65536);
flush();
}
fclose($fp);
@unlink($fullpath);
} else {
common_Logger::e('Unable to open File to export' . $fullpath);
}
} else {
common_Logger::e('Could not find File to export: ' . $fullpath);
}
}
示例4: scriptRunner
public function scriptRunner($script, $extension)
{
$error = false;
$errorStack = array();
if (isset($extension) && $extension != null) {
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById($extension);
}
if ($script != null) {
$parameters = array();
$options = array('argv' => array(0 => 'Script ' . $script), 'output_mode' => 'log_only');
try {
$scriptName = $script;
if (!class_exists($scriptName)) {
throw new taoUpdate_models_classes_UpdateException('Could not find scriptName class ' . $script);
}
new $scriptName(array('parameters' => $parameters), $options);
$error = false;
} catch (Exception $e) {
common_Logger::e('Error occurs during update ' . $e->getMessage());
$error = true;
$errorStack[] = 'Error in script ' . $script . ' ' . $e->getMessage();
}
if ($error) {
echo json_encode(array('success' => 0, 'failed' => $errorStack));
} else {
echo json_encode(array('success' => 1, 'failed' => array()));
}
} else {
echo json_encode(array('success' => 0, 'failed' => array('not scriptname provided')));
}
}
示例5: compile
/**
* Compile an item.
*
* @param core_kernel_file_File $destinationDirectory
* @throws taoItems_models_classes_CompilationFailedException
* @return tao_models_classes_service_ServiceCall
*/
public function compile()
{
$destinationDirectory = $this->spawnPublicDirectory();
$item = $this->getResource();
$itemUri = $item->getUri();
$report = new common_report_Report(common_report_Report::TYPE_SUCCESS, __('Published %s', $item->getLabel()));
if (!taoItems_models_classes_ItemsService::singleton()->isItemModelDefined($item)) {
return $this->fail(__('Item \'%s\' has no model', $item->getLabel()));
}
$langs = $this->getContentUsedLanguages();
foreach ($langs as $compilationLanguage) {
$compiledFolder = $this->getLanguageCompilationPath($destinationDirectory, $compilationLanguage);
if (!is_dir($compiledFolder)) {
if (!@mkdir($compiledFolder)) {
common_Logger::e('Could not create directory ' . $compiledFolder, 'COMPILER');
return $this->fail(__('Could not create language specific directory for item \'%s\'', $item->getLabel()));
}
}
$langReport = $this->deployItem($item, $compilationLanguage, $compiledFolder);
$report->add($langReport);
if ($langReport->getType() == common_report_Report::TYPE_ERROR) {
$report->setType(common_report_Report::TYPE_ERROR);
break;
}
}
if ($report->getType() == common_report_Report::TYPE_SUCCESS) {
$report->setData($this->createService($item, $destinationDirectory));
} else {
$report->setMessage(__('Failed to publish %s', $item->getLabel()));
}
return $report;
}
示例6: getPublicAccessUrl
public function getPublicAccessUrl()
{
if (is_null($this->accessProvider)) {
common_Logger::e('accessss');
throw new common_Exception('Tried obtaining access to private directory with ID ' . $this->id);
}
return $this->accessProvider->getAccessUrl($this->relPath);
}
示例7: getPublicAccessUrl
/**
* Returns a URL that allows you to access the files in a directory
* preserving the relative paths
*
* @return string
* @throws common_Exception
*/
public function getPublicAccessUrl()
{
if (is_null($this->accessProvider)) {
common_Logger::e('accessss');
throw new common_Exception('Tried obtaining access to private directory with ID ' . $this->getId());
}
return $this->accessProvider->getAccessUrl($this->prefix . DIRECTORY_SEPARATOR);
}
示例8: backup
public function backup()
{
if (count($this->error) > 0) {
common_Logger::e('Fail to dump database');
return false;
}
return $this->dump;
}
示例9: loginUser
/**
* authenticate a user
*
* @access public
* @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
* @param string login
* @param string password
* @return boolean
* @deprecated
*/
public function loginUser($login, $password)
{
$returnValue = (bool) false;
try {
$returnValue = LoginService::login($login, $password);
} catch (core_kernel_users_Exception $ue) {
common_Logger::e("A fatal error occured at user login time: " . $ue->getMessage());
}
return (bool) $returnValue;
}
示例10: durationToTime
/**
* Converts a duration to a time
* @param string $duration the ISO duration
* @return string time hh:mm:ss.micros
*/
public static function durationToTime($duration)
{
$time = null;
try {
$interval = preg_match('/(\\.[0-9]{1,6}S)$/', $duration) ? new DateIntervalMS($duration) : new DateInterval($duration);
$time = self::intervalToTime($interval);
} catch (Exception $e) {
common_Logger::e($e->getMessage());
}
return $time;
}
示例11: durationToTime
/**
* Converts a duration to a time
* @param string $duration the ISO duration
* @return string time hh:mm:ss
*/
public static function durationToTime($duration)
{
$time = null;
try {
$interval = new DateInterval($duration);
$time = self::intervalToTime($interval);
} catch (Exception $e) {
common_Logger::e($e->getMessage());
}
return $time;
}
示例12: __construct
/**
* @author "Lionel Lecaque, <lionel@taotesting.com>"
* @param array $params
* @throws tao_install_utils_Exception
*/
public function __construct($params)
{
try {
$this->connection = $this->buildDbalConnection($params);
$this->dbConfiguration = $params;
$this->buildSchema();
} catch (Exception $e) {
$this->connection = null;
common_Logger::e($e->getMessage() . $e->getTraceAsString(), 'INSTALL');
throw new tao_install_utils_Exception('Unable to connect to the database ' . $params['dbname'] . ' with the provided credentials: ' . $e->getMessage());
}
}
示例13: isDesignModeEnabled
/**
*
* @access public
* @author "Lionel Lecaque, <lionel@taotesting.com>"
*/
public static function isDesignModeEnabled()
{
$returnValue = true;
$optimizableClasses = tao_helpers_Optimization::getOptimizableClasses();
foreach ($optimizableClasses as $class) {
if (isset($class['status'])) {
$returnValue &= $class['status'] == tao_helpers_Optimization::DECOMPILED;
} else {
common_Logger::e('Problem occcurs when checking if design mode enable');
return false;
}
}
return $returnValue;
}
示例14: logEvent
/**
* @param Event $event
*/
public static function logEvent(Event $event)
{
$action = 'cli' === php_sapi_name() ? $_SERVER['PHP_SELF'] : Context::getInstance()->getRequest()->getRequestURI();
/** @var common_session_Session $session */
$session = common_session_SessionManager::getSession();
/** @var common_user_User $currentUser */
$currentUser = $session->getUser();
$data = is_subclass_of($event, JsonSerializable::class) ? $event : [];
try {
static::getStorage()->log($event->getName(), $action, $currentUser->getIdentifier(), join(',', $currentUser->getPropertyValues(PROPERTY_USER_ROLES)), (new DateTime('now', new \DateTimeZone('UTC')))->format(DateTime::ISO8601), json_encode($data));
} catch (\Exception $e) {
\common_Logger::e('Error logging to DB ' . $e->getMessage());
}
}
示例15: isDesignModeEnabled
/**
*
* @access public
* @author "Lionel Lecaque, <lionel@taotesting.com>"
*/
public static function isDesignModeEnabled()
{
$returnValue = true;
$extensions = common_ext_ExtensionsManager::singleton()->getInstalledExtensions();
if (!isset($extensions['generisHard'])) {
return false;
}
$optimizableClasses = Optimization::getOptimizableClasses();
foreach ($optimizableClasses as $class) {
if (isset($class['status'])) {
$returnValue &= $class['status'] == Optimization::DECOMPILED;
} else {
common_Logger::e('Problem occcurs when checking if design mode enable');
return false;
}
}
return $returnValue;
}