当前位置: 首页>>代码示例>>PHP>>正文


PHP LogHelper::log_error方法代码示例

本文整理汇总了PHP中LogHelper::log_error方法的典型用法代码示例。如果您正苦于以下问题:PHP LogHelper::log_error方法的具体用法?PHP LogHelper::log_error怎么用?PHP LogHelper::log_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LogHelper的用法示例。


在下文中一共展示了LogHelper::log_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerServer

 protected function registerServer($host, $port)
 {
     $result = $this->memcache->addServer($host, $port);
     if (!$result) {
         LogHelper::log_error(t('[@cacheType] Could not add server (@host:@port)', array('@cacheType' => self::$CACHE__TYPE, '@host' => $host, '@port' => $port)));
     }
     return $result;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:8,代码来源:MemcacheHandler.php

示例2: __destruct

    public function __destruct() {
        // because it is executed in destructor we should not allow exceptions to reach PHP script execution engine
        // otherwise execution of the script will halt
        try {
            $this->flush();
        }
        catch (Exception $e) {
            LogHelper::log_error($e);
        }

        parent::__destruct();
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:12,代码来源:DefaultEventRecorderFactory.php

示例3: detectDatasetSourceType

 public static function detectDatasetSourceType(DatasetMetaData $dataset)
 {
     if (isset($dataset->assembler)) {
         return self::DATASET_SOURCE_TYPE__DYNAMIC;
     } elseif (isset($dataset->source)) {
         $source = trim($dataset->source);
         $isTableName = strpos($source, ' ') === FALSE;
         return $isTableName ? self::DATASET_SOURCE_TYPE__TABLE : self::DATASET_SOURCE_TYPE__SUBQUERY;
     }
     LogHelper::log_error($dataset);
     throw new IllegalArgumentException(t('Could not detect type of dataset source for the dataset: @datasetName', array('@datasetName' => $dataset->publicName)));
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:12,代码来源:DatasetTypeHelper.php

示例4: mergeWith

 public static function mergeWith(&$instance, $source, $mergeCompositeProperty = FALSE)
 {
     if (isset($source)) {
         if (is_object($source) || is_array($source)) {
             foreach ($source as $name => $value) {
                 // source does not have value for the property
                 if (!isset($value)) {
                     continue;
                 }
                 // we do not support composite properties
                 if (is_object($value) || is_array($value)) {
                     if ($mergeCompositeProperty) {
                         if (!isset($instance->{$name})) {
                             $instance->{$name} = NULL;
                         }
                         if (is_object($value)) {
                             // support for an object
                             self::mergeWith($instance->{$name}, $value, TRUE);
                         } else {
                             if (ArrayHelper::isIndexedArray($value)) {
                                 // support for an indexed array
                                 $a = NULL;
                                 foreach ($value as $index => $v) {
                                     $o = NULL;
                                     self::mergeWith($o, $v, TRUE);
                                     $a[$index] = $o;
                                 }
                                 $instance->{$name} = $a;
                             } else {
                                 // support for an associative array
                                 self::mergeWith($instance->{$name}, $value, TRUE);
                             }
                         }
                     }
                     continue;
                 }
                 // overriding is not allowed
                 if (isset($instance->{$name}) && $instance->{$name} != $value) {
                     LogHelper::log_error(t("'@propertyName' property already contains value: @existingPropertyValue. Merge cannot be performed with new value: @newPropertyValue", array('@propertyName' => $name, '@existingPropertyValue' => $instance->{$name}, '@newPropertyValue' => $value)));
                     throw new UnsupportedOperationException(t("'@propertyName' property already contains value. Merge cannot be performed", array('@propertyName' => $name)));
                 }
                 $instance->{$name} = $value;
             }
         } else {
             $instance = $source;
         }
     }
     return $instance;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:49,代码来源:ObjectHelper.php

示例5: render

    public function render ( $data ) {
        ob_start();

        if ( isset($_REQUEST['cache']) ) {
            header('Cache-Control: no-transform,public,max-age=300,s-maxage=900');
            header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
        } else {
            header("Pragma: public");
            header("Expires: 0");
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Cache-Control: private",false);
        }
        header('Content-Description: File Transfer');
        header("Content-Type: application/octet-stream");
        header("Content-Transfer-Encoding: binary");
        header('Content-Disposition: attachment; filename="' . $this->filename . '.xls"');

        $objPHPExcel = new PHPExcel();

        $rowNumber = 1;
        if ( is_array($data) ) {
            foreach ( $data as $row ) {
                $col = 'A';
                foreach ( $row as $cell ) {
                    $objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
                    $col++;
                }
                $rowNumber++;
            }
        } else {
            LogHelper::log_error('Expecting array of data for export');
            LogHelper::log_error($data);
        }

        // Save as an Excel BIFF (xls) file
        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        $objWriter->save('php://output');

        gd_get_session_messages(); // log and clear any messages

        $output = ob_get_clean();

        if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) || empty($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
            // the content length may vary if the server is using compression
            header('Content-Length: '.strlen($output));
        }

        return $output;
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:49,代码来源:GD_ServicesViewFormat_Excel.php

示例6: checkValueAsWord

 public static function checkValueAsWord($value)
 {
     if (!isset($value)) {
         return;
     }
     $result = preg_match('/^[a-zA-Z_]\\w*$/', $value);
     if ($result === FALSE) {
         $lastError = preg_last_error();
         LogHelper::log_error(t("'@value' could not be validated as a word: Regular expression error: @lastError", array('@value' => $value, '@lastError' => $lastError)));
     } elseif ($result == 0) {
         LogHelper::log_error(t("'@value' is not a word", array('@value' => $value)));
     } else {
         return;
     }
     throw new IllegalArgumentException(t("'@value' is not a word", array('@value' => $value)));
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:16,代码来源:StringDataTypeHandler.php

示例7: getExportColumnName

    public static function getExportColumnName ( $uiMetaDataName, MetaModel $metamodel ) {

        if ( trim($uiMetaDataName) == '' ) {
            $message = t('Empty columnName discovered');
            drupal_set_message($message, 'warning');
            LogHelper::log_warn($message);

            return $uiMetaDataName;
        }


        list($elementNameSpace, $name) = AbstractDatasetUIMetaDataGenerator::splitElementUIMetaDataName($uiMetaDataName);
        switch ( $elementNameSpace ) {

            case AbstractAttributeUIMetaData::NAME_SPACE:
                list($referencedDimensionName, $dimensionColumnName) = ParameterNameHelper::split($name);
                list($datasetName, $dimensionName) = ReferencePathHelper::splitReference($referencedDimensionName);
                if (isset($datasetName)) {
                    $adjustedReferencedDimensionName = ReferencePathHelper::assembleReference(self::getExportDatasetName($datasetName,$metamodel), $dimensionName);
                    $name = ParameterNameHelper::assemble($adjustedReferencedDimensionName, $dimensionColumnName);
                }
                break;

            case AbstractMeasureUIMetaData::NAME_SPACE:
                list($datasetName, $measureName) = ReferencePathHelper::splitReference($name);
                if (isset($datasetName)) {
                    $name = ReferencePathHelper::assembleReference(self::getExportDatasetName($datasetName,$metamodel), $measureName);
                }
                break;

            case FormulaUIMetaData::NAME_SPACE:
                list($datasetName, $formulaName) = ReferencePathHelper::splitReference($name);
                if (isset($datasetName)) {
                    $name = ReferencePathHelper::assembleReference(self::getExportDatasetName($datasetName,$metamodel), $formulaName);
                }
                break;

            default:
                $message = t('Unsupported UI Meta Data name space: @uiMetaDataName', array('@uiMetaDataName' => $uiMetaDataName));
                LogHelper::log_error($message);
                throw new UnsupportedOperationException($message);
        }

        return AbstractDatasetUIMetaDataGenerator::prepareElementUIMetaDataName($elementNameSpace, $name);
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:45,代码来源:DatasetExportHelper.php

示例8: get_node_field_value

/**
* This file is part of the Checkbook NYC financial transparency software.
* 
* Copyright (C) 2012, 2013 New York City
* 
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
* 
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
function get_node_field_value($node, $propertyName, $index = 0, $storageSuffixName = 'value', $required = FALSE)
{
    $value = NULL;
    $nodePropertyValue = isset($node->{$propertyName}) ? $node->{$propertyName} : NULL;
    if (isset($nodePropertyValue[$node->language][$index][$storageSuffixName])) {
        $value = $nodePropertyValue[$node->language][$index][$storageSuffixName];
        if (is_string($value)) {
            $value = trim($value);
            if (strlen($value) === 0) {
                $value = NULL;
            }
        }
    }
    if ($required && !isset($value)) {
        LogHelper::log_error($node);
        throw new IllegalArgumentException(t('@propertyName@index has not been set for the node: @nodeId', array('@nodeId' => $node->nid, '@propertyName' => $propertyName, '@index' => $index == 0 ? '' : t('[@index]', array('@index' => $index)))));
    }
    return $value;
}
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:37,代码来源:NodeFieldHelper.php

示例9: render

    public function render ( $data ) {
        ob_start();

        if ( isset($_REQUEST['cache']) ) {
            header('Cache-Control: no-transform,public,max-age=300,s-maxage=900');
            header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
        } else {
            header("Pragma: public");
            header("Expires: 0");
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Cache-Control: private",false);
        }
        header('Content-Description: File Transfer');
        header("Content-Type: text/csv");
        header('Content-Disposition: attachment; filename="' . $this->filename . '.csv"');

        $outStream = fopen("php://output", 'w');
        if ( is_array($data) ) {
            foreach ( $data as $item ) {
                if ( is_array($item) ) {
                    fputcsv($outStream, $item, ',', '"');
                } else {
                    LogHelper::log_error('Expecting array of data for export');
                    LogHelper::log_error($item);
                }
            }
        } else {
            LogHelper::log_error('Expecting array of data for export');
            LogHelper::log_error($data);
        }
        fclose($outStream);

        gd_get_session_messages(); // log and clear any messages

        $output = ob_get_clean();

        if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) || empty($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
            // the content length may vary if the server is using compression
            header('Content-Length: '.strlen($output));
        }

        return $output;
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:43,代码来源:GD_ServicesViewFormat_CSV.php

示例10: addUniqueValue

 public static function addUniqueValue(array &$array = NULL, $value)
 {
     if (isset($value)) {
         if (is_array($value)) {
             LogHelper::log_error(t("[@value] should not be an array", array('@value' => implode(', ', $value))));
             throw new IllegalArgumentException(t('Value should not be an array'));
         }
         if (isset($array)) {
             if (array_search($value, $array) === FALSE) {
                 $array[] = $value;
                 return TRUE;
             }
         } else {
             $array[] = $value;
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:19,代码来源:ArrayHelper.php

示例11: assemble

    public function assemble(ColumnMetaData $column) {
        $expression = NULL;
        
        if ($column->persistence == FormulaMetaData::PERSISTENCE__CALCULATED) {
            $this->columnAssemblingStack = array();

            array_push($this->columnAssemblingStack, $column->name);

            try {
                if (!isset($column->source)) {
                    throw new IllegalStateException(t('Formula expression is not provided'));
                }

                $language = isset($column->expressionLanguage) ? $column->expressionLanguage : NULL;
                $parser = new FormulaExpressionParser($language);

                $expression = $parser->expressionLanguageHandler->clean($column->source);

                $expression = $parser->parse($expression, array($this, 'replaceColumnNames'));
                $expression = $parser->insertMarker('', 0, $expression, TRUE);

                $lexemes = $parser->expressionLanguageHandler->lex($expression);
                $syntaxTree = $parser->expressionLanguageHandler->parse($lexemes);
                $expression = $parser->expressionLanguageHandler->generate($syntaxTree);
            }
            catch (Exception $e) {
                LogHelper::log_error($e);
                throw new IllegalStateException(t(
                    "Cannot assemble expression for %columnName formula: %error",
                    array('%columnName' => $column->publicName, '%error' => $e->getMessage())));
            }

            array_pop($this->columnAssemblingStack);
        }
        else {
            $expression = $column->name;
        }

        return $expression;
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:40,代码来源:FormulaExpressionAssembler.php

示例12: getWarningBody

    public function getWarningBody(array $options = array()) {

        $body = '<div class="report-container" id="reportId-' . intval($this->ReportConfig->getId()) .'" class="report">';

        $messages = '<li>The report is configured incorrectly</li><li>The report is using a column that was removed from the system</li>';

        if (isset($options['error'])) {
            $messages .= '<li>' . $options['error'] . '</li>';
            if (isset($_SESSION['messages'])) {
                if (isset($_SESSION['messages']['error'])) {
                    foreach ($_SESSION['messages']['error'] as $error) {
                        $messages .= '<li>' . $error . '</li>';
                        LogHelper::log_error($error);
                    }
                }
                unset($_SESSION['messages']);
            }
        }

        $body .= '<div class="alert alert-warning alert-dismissible" role="alert" style="text-align: left;"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button><h4>The report could not be rendered!</h4>Possible causes may include any of the following:<ol>'.$messages.'</ol></div>';


        return $body.'</div>';
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:24,代码来源:ReportView.php

示例13: castValueImpl

    protected function castValueImpl($value) {
        // do not use procedural style. We need an exception in case of error
        try  {
            $dt = new DateTime($value);
        }
        catch (Exception $e) {
            LogHelper::log_error($e);
            throw new IllegalArgumentException(t('Failed to parse datetime string: %value', array('%value' => $value)));
        }

        return $dt->format($this->getFormat());
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:12,代码来源:DateDataTypeHandler.php

示例14: gd_sync_import_update_form_submit

/**
 * @param $form
 * @param $form_state
 * @throws Exception
 */
function gd_sync_import_update_form_submit ( $form, &$form_state ) {
    try {
        $content = json_decode($form_state['values']['content']);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new Exception('Invalid JSON');
        }

        $importContext = new GD\Sync\Import\ImportContext(array('datasourceName'=>$form_state['values']['datasourceName'],'operation'=>'update'));
        $importStream = new GD\Sync\Import\ImportStream();
        $importStream->set(null,$content);

        $importController = new \GD\Sync\Import\ImportController();
        $importController->import($importStream,$importContext);

        drupal_set_message('Datasource Updated Successfully');
    } catch ( Exception $e ) {
        LogHelper::log_error($e);
        drupal_set_message($e->getMessage(),'error');
    }
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:25,代码来源:gd_sync.admin.php

示例15: gd_dashboard_report_page_preview

/**
 * Report preview for admin
 * @return void
 */
function gd_dashboard_report_page_preview () {
    if ( empty($_POST['dashboard']) || empty($_POST['report']) && empty($_POST['ds']) ) {
        $message =  'Missing required params for preview';
        LogHelper::log_error($message);
        echo  $message;
    } else {
        /**
         *  Dashboard
         */
        $dashboard = json_decode($_POST['dashboard']);

        /**
         * Report
         */
        $report = json_decode($_POST['report']);
        gd_datasource_set_active($_POST['ds']);

        $DashboardConfig = new GD_DashboardConfig($dashboard);

        foreach ( $DashboardConfig->items as $item ) {
            if ( $report->id == $item->content ) {
                $options = array('admin' => true);
                $html = $DashboardConfig->getItemReportView($item, $options);

                print $DashboardConfig->getDashboardCustomView()
                    . $html->header
                    . $html->body
                    . $html->footer;
            }
        }
    }

    drupal_exit();
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:38,代码来源:gd_dashboard.pages.php


注:本文中的LogHelper::log_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。